# Numbering All Equations in Two-Level Optimization Problem

Similar to a previous question, I need to construct a bilevel optimization. The previous question received a good answer except I need to number each equation even those in the nested aligned block.

What would be the simplest way to modify the structure below to support number of all equations? The nested aligned block yields a compile error if changed to align.

MWE (basic structure courtesy of @sergei-golovan)

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\st}{s.t.}
\begin{document}

\begin{align}
\min \limits_{\mathbf{x}, \mathbf{y}} \quad & {-}2x_1^2 + x_2^2 - 6y_1 + y_2^2 \\
\st \quad & x_1^3 + 3x_2 - 10 \le 0 \\
& \begin{aligned}
\st \quad & {-}x_1 + 2x_1 - x_2^2 \le 0\\
& {-}x_1 + 2x_2 \le 0
\end{aligned}
\end{align}
\end{document} Here are two possibilities with the optidef package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{optidef}
\DeclareMathOperator{\st}{s.t.}

\begin{document}

\begin{mini!}|s|
{\mathbf{x, y}}{-2x_1^2 + x_2^2 - 6y_1 + y_2^2}{\label{objective}}{}
\addConstraint{x_1^3 + 3x_2 - 10}{\le 0 \label{ineq:C1}}
\addConstraint{-x_1 + 2x_1 - x_2^2}{\le 0\label{ineq:C2}}
\addConstraint{-x_1 + 2x_2}{\le 0\label{ineq:C3}}
\end{mini!}

\begin{mini!}|s|
{\mathbf{x, y}}{-2x_1^2 + x_2^2 - 6y_1 + y_2^2\tag{2}}{\label{objective}}{}
\addConstraint{x_1^3 + 3x_2 - 10}{\le 0 \label{ineq:C1}}
\addConstraint{{-x_1} + 2x_1 - x_2^2}{\le 0\label{ineq:C2}}
\addConstraint{{-x_1} + 2x_2}{\le 0\label{ineq:C3}}
\end{mini!}

\end{document} Edit: a workaround for two-level constraints:

\begin{mini!}|s|
{\mathbf{x, y}}{-2x_1^2 + x_2^2 - 6y_1 + y_2^2\tag{2}}{\label{objective}}{}
\addConstraint{x_1^3 + 3x_2 - 10\tag{3}}{\le 0 \label{ineq:C1}}
\end{mini!} • In these bilevel optimizations, the second set of constraints (e.g., Eq. (3) in the MWE needs a second s.t. since those constraints are specific to the first s.t. (Eq. (2)). Is that possible in optidef? My quick trial did not work. Sep 19, 2020 at 20:26
• I didn't have understood this. I'll try to find a workaround. Sep 19, 2020 at 20:29
• @ZaydH: I've added another variant code. Does it correspond to what you want? Sep 19, 2020 at 20:43
• I am very sorry @Bernard for me being dense here but I do not see the edit above. The "edited" link is not showing like it is for Isitar's answer. Sep 19, 2020 at 21:07
• @ZaydH: I'm afraid I posted it with another answer… :-( Anyway, now it's added to this answer. Sep 19, 2020 at 21:16

you can use another package named optidef: https://www.ctan.org/pkg/optidef here is your problem:

\usepackage{optidef}
\begin{document}

\begin{mini!}|s|<b>
{x,y}{-x^2_1+x^2_2-6y_1+y^2_2}
{}{} 