[Tex/LaTex] Typesetting an optimisation problem

alignamsmathsubequations

I am quite new to LaTeX and want to typeset a optimisation problem.
I found a very neat example at https://jcnts.wordpress.com/2009/11/11/formatting-optimization-problems-with-latex/:

enter image description here

The only problem is it don't show a new equation number for each line. So I changed it and now get the equation numbers but there's a huge gap between min/subject to and the cost function/constraints now. Is there any possibility to combine the best of both approaches?

Code for both approaches:

\documentclass{report}
\usepackage{amsmath}
\usepackage{hyperref}
\newcommand{\norm}[1]{\lVert#1\rVert_2}

\begin{document}
my approach
\begin{subequations}
    \begin{align}
    &\underset{x}{\text{min}}
    &&\norm{f(x)}^2\label{eq:optProb}\\
    &\text{subject to}
    &&\alpha \geq 0,\label{eq:constraint1}\\
    &&&\beta \geq 0.\label{eq:constraint2}
    \end{align}
\end{subequations}
%
%
approach from\\ \url{https://jcnts.wordpress.com/2009/11/11/formatting-optimization-problems-with-latex/}:
\begin{equation}
    \begin{aligned}
        &\underset{x}{\text{min}}&&\norm{f(x)}^2\\
        &\text{subject to} &&\alpha \geq 0,\\
        &&&\beta \geq 0.
    \end{aligned}
\end{equation}
\end{document}

Best Answer

Just change align into alignat:

\documentclass{report}
\usepackage{amsmath}

\newcommand{\norm}[1]{\lVert#1\rVert_2}

\begin{document}

\begin{subequations}
\begin{alignat}{2}
&\!\min_{x}        &\qquad& \norm{f(x)}^2\label{eq:optProb}\\
&\text{subject to} &      & \alpha \geq 0,\label{eq:constraint1}\\
&                  &      & \beta \geq 0.\label{eq:constraint2}
\end{alignat}
\end{subequations}

\end{document}

enter image description here