1

I am trying nicely (and correctly) align two level optimization problem. At the moment came up with the following solution:

$
\begin{array}{llr}
    \min \limits_{\mathbf{x}, \mathbf{y}} & -2x_1^2 + x_2^2 - 6y_1 + y_2^2 \\
    \st & x_1^3 + 3x_2 - 10 \le 0 \\
        & \displaystyle \mathbf{y} \in \argmin_{\mathbf{y}\in [0, 10]^2} \; 2x_1^2 + 2y_1^2 - 8y_2 \\
            & \hspace{1.25cm} \st - x_1 + 2x_1 - x_2^2 + 2y_1 - y_2 - 3 \le 0\\
            & \hspace{1.9cm}     - x_1 + 2x_1 - x_2^2 + 2y_1 - y_2 - 3 \le 0 \\
      & \mathbf{x} \in [-10, 10]^2,\; \mathbf{y} \in [-10, 10]^2
\end{array}
$

Which produces the following output:

enter image description here

Here I highlighted couple issues:

  1. What would be a better way (compared to manual hspace{} the first constraint starting with keywords "s.t." align based on the upper line min keyword (see blue line in the picture). The rest constraints should be left-aligned by the first constraint.
  2. Why am I getting different spacing for the inner constraints? Both are completely the same, but in the first constraint there is a bigger space after the minus sign (situation highlighted in picture in red "circle")
2
  • Try {} - x_1 on the second line enclosed in the red circle. The {} should create a (empty) group, which changes the minus-sign from an unary negative sign to an binary operator as in a - b.
    – Jan
    Feb 7, 2017 at 13:58
  • 2
    1. I'd say that it's better to treat argmin as one word and align s.t. to arg' (as you can see, the y\in[0,10]^2` is placed under argmin, not under min. What you want appears inconsistent. 2. The first - is incorrectly recognized as a binary operator. Just surround it with braces {-}x_1... to get the correct unary operator spacing. Feb 7, 2017 at 14:00

1 Answer 1

3

Instead of the array environment, I'd suggest to try aligned (which is basically an array but with spacing more suitable for math). The MWE could be the following:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\st}{s.t.}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}

\[
\begin{aligned}
    &\min \limits_{\mathbf{x}, \mathbf{y}} && {-}2x_1^2 + x_2^2 - 6y_1 + y_2^2 \\
    &\st && x_1^3 + 3x_2 - 10 \le 0 \\
        &&&\mathbf{y} \in
     \begin{aligned}[t]
        &\argmin_{\mathbf{y}\in [0, 10]^2} && 2x_1^2 + 2y_1^2 - 8y_2 \\
            &\st &&{-}x_1 + 2x_1 - x_2^2 + 2y_1 - y_2 - 3 \le 0\\
            &&&{-}x_1 + 2x_1 - x_2^2 + 2y_1 - y_2 - 3 \le 0
     \end{aligned}\\
      &&&\mathbf{x} \in [-10, 10]^2,\; \mathbf{y} \in [-10, 10]^2
\end{aligned}
\]
\end{document}

Note that I defined \st as a math operator. It's just to get spacing around it similar to \max and \argmax, otherwise the correct alignment would be trickier to produce. Another idea is to typeset the inner optimization problem using nested aligned, which is cleaner. But don't forget to brace the unary minuses, as aligned automatically thinks that an operator following & is binary.

The result can be seen at the picture

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.