A bit late but it might help other people looking for the same answer. The package optidef was intended as the easy way to define optimization problems.
\usepackage{optidef}
\begin{mini}|l|
{w,u}{f(w)+ R(w+6x)}{}{}
\addConstraint{g(w_k)+h(w_k)}{=0,}{k=0,\ldots,N-1}
\addConstraint{l(w_k)}{=5u,\quad}{k=0,\ldots,N-1}
\end{mini}
The package has several more options. Below some examples are provided. To have a completely overview of the features and options check the documentation.
Using a shorter description of minimize/subject to.##
\usepackage[short]{optidef}
\begin{mini}
{w,u}{f(w)+ R(w+6x)}{}{}
\addConstraint{g(w_k)+h(w_k)}{=0,}{k=0,\ldots,N-1}
\addConstraint{l(w_k)}{=5u,\quad}{k=0,\ldots,N-1}
\end{mini}
##Breaking the objective accross several lines.##
\usepackage[long]{optidef}
\begin{mini}
{w,u}{f(w)+ R(w+6x)+ H(100w-x*w/500)}{}{}
\breakObjective{-g(w^3-x^2*200+10000*w^5)}
\addConstraint{g(w_k)+h(w_k)}{=0,}{k=0,\ldots,N-1}
\addConstraint{l(w_k)}{=5u,\quad}{k=0,\ldots,N-1}
\end{mini}
Multilabeling/no labeling:
\begin{mini*}
{w}{f(w)+ R(w+6x)}
{}{}
\addConstraint{g(w)}{=0}
\end{mini*}
\begin{mini!}
{w}{f(w)+ R(w+6x)}
{}{}
\addConstraint{g(w)}{=0}
\end{mini!}
Alignment position of constraints with respect to the objective:
Alternative 1
\begin{mini}[2]
{w}{f(w)+ R(w+6x)}
{\label{eq:Ex1}}{}
\addConstraint{g(w)+h(w)}{=0}
\addConstraint{t(w)}{=0.}
\end{mini}
Alternative 2
\begin{mini}[3]
{w}{f(w)+ R(w+6x)}
{\label{eq:Ex1}}{}
\addConstraint{g(w)+h(w)}{=0}
\addConstraint{t(w)}{=0.}
\end{mini}
Alternative 3
\begin{mini}[4]
{w}{f(w)+ R(w+6x)}
{\label{eq:Ex1}}{}
\addConstraint{g(w)+h(w)}{=0}
\addConstraint{t(w)}{=0.}
\end{mini}
Other optimization environments
argmini
\begin{argmini}
{w}{f(w)+ R(w+6x)}
{}{}
\addConstraint{g(w)}{=0}
\end{argmini}
maxi
\begin{maxi}
{w}{f(w)+ R(w+6x)}
{}{}
\addConstraint{g(w)}{=0}
\end{maxi}
argmaxi
\begin{argmaxi}
{w}{f(w)+ R(w+6x)}
{}{}
\addConstraint{g(w)}{=0}
\end{argmaxi}
Full details on the different implementations above (and more details) can be found in the documentation: http://mirrors.ctan.org/macros/latex/contrib/optidef/optidef.pdf.
Feature requests and discussion of issues can be done through the github page: https://github.com/jeslago/optidef