diff options
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/optidef/README.md | 73 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/optidef/optidef.pdf | bin | 0 -> 194434 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/optidef/optidef.tex | 768 |
3 files changed, 841 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/optidef/README.md b/Master/texmf-dist/doc/latex/optidef/README.md new file mode 100644 index 00000000000..d45c533de0a --- /dev/null +++ b/Master/texmf-dist/doc/latex/optidef/README.md @@ -0,0 +1,73 @@ +# optidef - Version 08/06/2016 + + +Copyright 2016 J. Lago Garcia + +This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. +The latest version of this license is in http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status 'maintained'. The Current Maintainer of this work is J. Lago Garcia, under the supervision of Prof. Dr. Moritz Diehl and Prof. Dr. Sebastien Gross. + +E-mail: jesus.lago.garcia@venus.uni-freiburg.de + +This work consists of the file optidef.sty. + +---------- +FEATURES +Optidef is a small library that provides a standard set of environments for writing optimization problems. The most important features are: + +- It automatically aligns the problems in three points with an optional fourth: + + * Beginning of the words "minimize/argmin" and "subject to" + * The objective function and the longest left hand side of the constraints + * The $= | > | <$ signs of the constraints. + * Optionally, the user can add manually a double align character \&\& to align some common constraints feature. A clear example could be the constraints names, e.g. (boundary constraint) alignment with (dynamic constraint), or the index of the constraints, e.g. in the case of having something like $h(x_k,u_k)\leq 0,\quad k=0,\ldots,N$, align the indexes $k=0,\ldots,N$ across constraint lines. + +- It provides an easy interface to define optimization problem for three different reference situations: + + * Where no equation is referenced/numbered. + * Where the problem is referenced with a single number. + * Where each equation has an individual reference. + +- It also allows a definition of any optimization problem without a limitless number of constraints. + +- It defines four types of optimization problems: + + * minimize + * maximize + * arg mini + * arg maxi + + +------ +# Syntax + +The syntax to define an optimization problem is given by: + + >\begin{mini#} + {Number of constraints} + {Optimization variable} + {Objective function \label{Objective function referece}} + {LHS Constraint 1}{RHS Constraint 1 \label{Reference Constraint 1}} + {\label{Global referece of Optimization Problem}} + {Result of the optimization problem or any expression on the left of the minimize word} + \addConstraint{LHS Constraint 2}{RHS Constraint 2 \label{Reference Constraint 2}} + \addConstraint{LHS Constraint 3}{RHS Constraint 3 \label{Reference Constraint 3}} + . + . + \finalConstraint{LHS N} {RHSConstraint N \label{Reference Constraint N}} + \end{mini#} + + +where mini# takes any of the following values: + + - mini\* for no referencing + - mini! for referencing each equation + - mini for referencing with a single label the whole problem. + +Notice that only the first three will be really necessary in every definition, nevertheless and for the sake of having homogeneous definitions, we opted for requiring the 7 parameters in every definition and expecting empty parameters definitions, i.e. \{\}, when they are not needed. + +After the definition of this parameters, the environment accepts the definition of an infinite number of constraints. Notice that the last constraint has to be defined using the \finalConstraint command, instead of the \addConstraint. + + +Finally note that \begin{mini#} can be substituted by \begin{maxi#}, \begin{argmini#} or \begin{argmaxi#}.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/optidef/optidef.pdf b/Master/texmf-dist/doc/latex/optidef/optidef.pdf Binary files differnew file mode 100644 index 00000000000..a82e8c09b8f --- /dev/null +++ b/Master/texmf-dist/doc/latex/optidef/optidef.pdf diff --git a/Master/texmf-dist/doc/latex/optidef/optidef.tex b/Master/texmf-dist/doc/latex/optidef/optidef.tex new file mode 100644 index 00000000000..a5147d46c1a --- /dev/null +++ b/Master/texmf-dist/doc/latex/optidef/optidef.tex @@ -0,0 +1,768 @@ +\documentclass[]{report} +\usepackage{remreset} +\usepackage{optidef} + +% Title Page +\title{\textit{\textbf{Optidef}} \\ A Latex library for minimization/maximization problems definition} + +\author{Jesus Lago Garcia} + +\makeatletter +\renewcommand \thesection {\@arabic\c@section} +\@removefromreset{section}{chapter} +\makeatother + + +\begin{document} +\maketitle + +\section{Introduction and features} + +This small library provides a standard set of environments for writing minimization problems. The most important features are: +\begin{enumerate} + \item It automatically aligns the problems in three points with an optional fourth: + \begin{enumerate} + \item Beginning of the words "minimize/argmin" and "subject to" + \item The objective function and the longest left hand side of the constraints + \item The $= | > | <$ signs of the constraints. + \item Optionally, the user can add manually a double align character \&\& to align some common constraints feature. A clear example could be the constraints names, e.g. (boundary constraint) alignment with (dynamic constraint), or the index of the constraints, e.g. in the case of having something like $h(x_k,u_k)\leq 0,\quad k=0,\ldots,N$, align the indexes $k=0,\ldots,N$ across constraint lines. + \end{enumerate} + +\item It provides an easy interface to define optimization problem for three different reference situations: +\begin{enumerate} + \item Where no equation is referenced/numbered. + \item Where the problem is referenced with a single number. + \item Where each equation has an individual reference. +\end{enumerate} + +\item It also allows a definition of any optimization problem without a limitless number of constraints. + +\end{enumerate} + +\section{Environment types} +There are three basic environments depending on the type of referencing that should be used. +\begin{enumerate} + \item The \textbf{mini} environment for defining problems with a single reference label: + \begin{mini}{1} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {\label{eq:Ex1}}{} + \end{mini} + \item The \textbf{mini*} environment if the problem does not have to be referenced: + \begin{mini*}{1} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {}{} + \end{mini*} + \item The \textbf{mini!} environment if each equation should be referenced: + \begin{mini!}{1} + {w}{f(w)+ R(w+6x) + \nabla_w R \label{eq:Ex2}} + {g(w)}{=0} + {\label{eq:Ex1}}{} + \end{mini!} +\end{enumerate} + +\section{Environment Syntaxes} +The three environments use the same syntax with the same number of parameters. In particular, considering that LHS stands for Left-hand-side and RHS for Right-hand-side, the basic structure to define a general optimization problem is: +\begin{verbatim} + +\begin{mini#}{Number of constraints} + {Optimization variable} + {Objective function \label{Objective function referece}} + {LHS Constraint 1}{RHS Constraint 1 \label{Reference Constraint 1}} + {\label{Global referece of Optimization Problem}} + {Result of the optimization problem or any expression on + the left of the minimize word} + + \addConstraint{LHS Constraint 2}{RHS Constraint 2 \label{Reference Constraint 2}} + \addConstraint{LHS Constraint 3}{RHS Constraint 3 \label{Reference Constraint 3}} + . + . + \finalConstraint{LHS N} {RHSConstraint N \label{Reference Constraint N}} +\end{mini#} +\end{verbatim} + +\noindent where \# $\in \{*, !, ~ \}$. +\subsection{Parameters definition} +The number of parameters that the environment uses is 7: + +\begin{enumerate} + \item \verb|Number of constraints|, e.g. 0,1,2,3,4... + \item \verb|Optimization variable|, e.g. $w \in \Re^N$. + \item \verb|Objective function|, e.g. $\|w\|_2$. + \item \verb|LHS Constraint 1| (optional): the left-hand side of the first constraint, e.g. $3w^\top w$. For unconstrained problems leave it blank, i.e. \{\} + \item \verb|RHS Constraint 1| (optional): the right-hand side of the first constraints including the equal, less and greater signs, e.g. $\leq \|w\|_\infty$. For unconstrained problems leave it blank, i.e. \{\} + \item \verb|\label{Global referece of Optimization Problem}|: it defines the main and general reference for the optimization problem. It is used for the \verb|mini| and \verb|mini!| enviroments. In the \verb|mini*| environment leave it blank, i.e. \{\}. + \item \verb|Result of the optimization problem|: optionally a term expressing the result of the optimization problem, e.g. $J(w^*)~=$. +\end{enumerate} + +\noindent Notice that only the first three will be really necessary in every definition, nevertheless and for the sake of having homogeneous definitions, we opted for requiring the 7 parameters in every definition and expecting empty parameters definitions, i.e. \{\}, when they are not needed. + +After the definition of this parameters, the environment accepts the definition of an infinite number of constraints. For this definitions the command: + +\verb|\addConstraint{LHS Constraint k}| + +\verb|{RHS Constraint k \label{Reference Constraint k}}| + +\noindent has to be used, where the left hand side and right hand side syntax is the same as used for the mandatory third and fourth environment parameters. + +Notice that the last constraint has to be defined using the \verb|\finalConstraint| command, instead of the \verb|\addConstraint|. + +\subsubsection{Constraints referencing} +Notice that the label for the constraints is always included in the right hand side expression and it only makes sense for the case of using the \verb|mini!| enviroment. The label of the objective function can also be included in a similar way. + +\subsubsection{Example 1 - mini environment} +The code: + +\begin{verbatim} +\begin{mini}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + + {\label{eq:Example1}} + {} + + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{mini} +\end{verbatim} + +\noindent outputs: + +\begin{mini}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {\label{eq:Ex1}}{} + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{mini} + +\subsubsection{Example 2 - mini* environment} + +On the other hand: + +\begin{verbatim} +\begin{mini*}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0,} + + {}{} + + \addConstraint{n(w)}{= 6,} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{mini*} +\end{verbatim} + +\noindent it is almost the same but removing the reference: + +\begin{mini*}{3} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0,} + {}{} + \addConstraint{n(w)}{= 6, } + \addConstraint{L(w)+r(x)}{=Kw+p, } + \finalConstraint{h(x)}{=0.} +\end{mini*} + +\subsubsection{Example 3 - mini! environment} + +\noindent Finally, the multireferencing environment outputs: + +\begin{verbatim} +\begin{mini!}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R \label{eq:ObjectiveExample1}} + {g(w)}{=0 \label{eq:C1Example1}} + + {\label{eq:Example1}} + {} + + \addConstraint{n(w)}{= 6 \label{eq:C2Example1}} + \addConstraint{L(w)+r(x)}{=Kw+p \label{eq:C3Example1}} + \finalConstraint{h(x)}{=0. \label{eq:C4Example1}} +\end{mini!} +\end{verbatim} + +\begin{mini!}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R\label{eq:ObjectiveExample3}} + {g(w)}{=0 \label{eq:C1Example3}} + {\label{eq:Example3}} + {} + \addConstraint{n(w)}{= 6 \label{eq:C2Example3}} + \addConstraint{L(w)+r(x)}{=Kw+p \label{eq:C3Example3}} + \finalConstraint{h(x)}{=0. \label{eq:C4Example3}} +\end{mini!} + +\subsubsection{Example 4 - mini + problem result} + +\noindent Adding the problem result: + +\begin{verbatim} +\begin{mini}{4} +{w}{f(w)+ R(w+6x) + \nabla_w R} +{g(w)}{=0} + +{\label{eq:Example1}} +{J(w^*)=} + +\addConstraint{n(w)}{= 6} +\addConstraint{L(w)+r(x)}{=Kw+p} +\finalConstraint{h(x)}{=0.} +\end{mini} +\end{verbatim} + +\noindent outputs: + +\begin{mini}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {\label{eq:Ex1}}{J(w^*)~=~} + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{mini} + +\subsubsection{Example 5 - mini* + extra constraint alignment} +Adding the fourth optional alignment to add constraint names: + +\begin{verbatim} +\begin{mini*}{4} +{w}{f(w)+ R(w+6x) + \nabla_w R} +{g(w)}{=0, \quad && \text{(Dynamic constraint)}} + +{}{} + +\addConstraint{n(w)}{= 6, \quad && \text{(Boundary constraint)}} +\addConstraint{L(w)+r(x)}{=Kw+p, \quad && \text{(Random constraint)}} +\finalConstraint{h(x)}{=0.\quad && \text{(Path constraint)}} +\end{mini*} +\end{verbatim} + + +\begin{mini*}{3} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0, \quad && \text{(Dynamic constraint)}} + {}{} + \addConstraint{n(w)}{= 6, \quad && \text{(Boundary constraint)}} + \addConstraint{L(w)+r(x)}{=Kw+p, \quad && \text{(Random constraint)}} + \finalConstraint{h(x)}{=0. \quad && \text{(Path constraint).}} +\end{mini*} + + +\subsubsection{Example 6 - mini environment on the unconstrained case} + +\begin{verbatim} + +\begin{mini}{0} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {}{} + {}{} + {\label{eq:Ex4}} + {} +\end{mini} +\end{verbatim} + +\noindent outputs: + +\begin{mini}{0} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {}{} + {\label{eq:Ex4}}{} +\end{mini} + +\section{The \textit{argmini} environment} + Similar to the \verb|mini|, \verb|mini*| and \verb|mini!| environments, the environments \verb|argmini|, \verb|argmini*| and \verb|argmini!| are very similar environments that use the same syntax but the output is slightly different. The following code serves for illustration: + +\begin{verbatim} +\begin{argmini}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + + {\label{eq:Example1}}{w^*=} + + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{argmini} +\end{verbatim} + +\noindent outputs: + +\begin{argmini}{3} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {\label{eq:Ex1}}{w^*~=~} + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{argmini} + +\section{The \textit{maxi} and \textit{argmaxi} environments} +Exactly the same syntax and definition as the previous environments, but now for defining maximization environments. The following code serves for illustration: + +\begin{verbatim} +\begin{maxi}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + + {\label{eq:Example1}}{} + + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{maxi} +\end{verbatim} + +\noindent outputs: + +\begin{maxi}{4} + {w}{f(w)+ R(w+6x) + \nabla_w R} + {g(w)}{=0} + {\label{eq:Example1}}{} + \addConstraint{n(w)}{= 6} + \addConstraint{L(w)+r(x)}{=Kw+p} + \finalConstraint{h(x)}{=0.} +\end{maxi} + + +\section{Problems and limitations} +One current limitation is that the size of the optimization variables must be smaller than the word minimize, otherwise, the output is not properly aligned. Example: + +\begin{mini!}{3} + {x_0,u_0,x_1,\hdots,u_{N-1},x_N} + {\sum_{k=0}^{N-1} L(x_k,u_k)\!\!+\!\!E(x_N)\label{OCPobj}} + {x_{k+1}-f(x_k,u_k)}{= 0, \label{dOCP:modelc}\quad k=0,\dots,N-1} + {\label{eq:OCP}}{} + \addConstraint{h(x_k,u_k)}{\leq 0, \quad k=0,\dots,N-1} + \finalConstraint{r(x_0,x_N)}{= 0. \label{dOCP:boundary}} +\end{mini!} + +\noindent A possible way to avoid this is to stack them with the command: \begin{verbatim} +\substack{x_0,u_0,x_1,\hdots,\\u_{N-1},x_N} +\end{verbatim} + +\begin{mini!}{3} + {\substack{x_0,u_0,x_1,\hdots,\\ u_{N-1},x_N}} + {\sum_{k=0}^{N-1} L(x_k,u_k)\!\!+\!\!E(x_N)\label{OCPobj}} + {x_{k+1}-f(x_k,u_k)}{= 0, \label{dOCP:modelc}\quad k=0,\dots,N-1} + {\label{eq:OCP}}{} + \addConstraint{h(x_k,u_k)}{\leq 0, \quad k=0,\dots,N-1} + \finalConstraint{r(x_0,x_N)}{= 0. \label{dOCP:boundary}} +\end{mini!} + +\noindent If you want to increase the size of the optimization variables: +\noindent A possible way to avoid this is to stack them with the command: \begin{verbatim} +\substack{\displaystyle x_0,u_0,x_1,\hdots,\\ \displaystyle u_{N-1},x_N} +\end{verbatim} + +\begin{mini!}{3} + {\substack{\displaystyle x_0,u_0,x_1,\hdots,\\ \displaystyle u_{N-1},x_N}} + {\sum_{k=0}^{N-1} L(x_k,u_k)\!\!+\!\!E(x_N)\label{OCPobj}} + {x_{k+1}-f(x_k,u_k)}{= 0, \label{dOCP:modelc}\quad k=0,\dots,N-1} + {\label{eq:OCP}}{} + \addConstraint{h(x_k,u_k)}{\leq 0, \quad k=0,\dots,N-1} + \finalConstraint{r(x_0,x_N)}{= 0. \label{dOCP:boundary}} +\end{mini!} + +The other option is to define the set of variables before the problem definition as a single variable, i.e. $w = [x_0,u_0,x_1,\hdots,u_{N-1},x_N]$ and: + +%\begin{mini3!} +% {w} +% {\sum_{k=0}^{N-1} L(x_k,u_k)\!\!+\!\!E(x_N)}{\label{OCPobj}} +% {x_{k+1}-f(x_k,u_k)}{= 0, \label{dOCP:modelc}\quad k=0,\dots,N-1} +% {h(x_k,u_k)} {\leq 0, \quad k=0,\dots,N-1} +% {r(x_0,x_N)}{= 0. \label{dOCP:boundary}} +% \label{eq:OCP} +%\end{mini3!} + +\section{Code definition} +\begin{verbatim} +% optidef - Version 08/06/2016 +% +%Copyright 2016 J. Lago Garcia +% +%This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version. +%The latest version of this license is in http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. +% +%This work has the LPPL maintenance status 'maintained'. The Current Maintainer of this work is J. Lago Garcia, under the supervision of Prof. Dr. Moritz Diehl and Prof. Dr. Sebastien Gross. +% +%E-mail: jesus.lago.garcia@venus.uni-freiburg.de +% +%This work consists of the file optidef.sty. + + \NeedsTeXFormat{LaTeX2e} + \ProvidesPackage{optidef}[2016/06/06 Package for defining optimization problems] + + \RequirePackage{environ} + \RequirePackage{ifthen} + \RequirePackage{mathtools} + \RequirePackage{xifthen} + + % Input minimization evironments + + % Macros for objective definition, constraint definition and extra constraint definition + \newcommand{\bodyobj}[4] + { + \ifthenelse{\isempty{#4}} + { + &\underset{\displaystyle #1}{\mbox{#3}} \quad #2\span\span\span\span + } + { + #4 ~~ &\underset{\displaystyle #1}{\mbox{#3}} \quad #2\span\span\span\span + } + } + + + \newcommand{\bodyconst}[2] + {&\mbox{subject to} \quad  & #2\span\span} + + \newcommand{\addConstraint}[2]{&\quad  & #2, \\} + \newcommand{\finalConstraint}[2]{&\quad  & #2} + + + %\newcommand(\breakObjectiveUnconstraint)[1]{\\% + %\bodyobjUn{}{#1}{\phantom{minimize}}{}} + \newcommand{\breakObjectiveOneConstraint}[1]{&&\\} + %\newcommand(\breakObjective)[1]{\bodyobj{}{#4}{\phantom{minimize}}{}\nonumber\\} } + + \newcommand{\bodyconstOne}[2] + {&\text{subject to} \quad & #2} + + % This body of the objective is only valid for + % one constraint problem since there is no need to + % use mathllap to achieve second alignment level + \newcommand{\bodyobjOne}[4] + { + \ifthenelse{\isempty{#4}} + { + &\underset{\displaystyle #1}{\text{#3}} \quad & + } + { + #4 ~~ &\underset{\displaystyle #1}{\text{#3}} \quad &} + } + + + % This body of the objective is only valid for + % no constraint problem since there is no need to + % align + \newcommand{\bodyobjUn}[4] + { + \ifthenelse{\isempty{#4}} + { + } + { + #4~ + } + \underset{\displaystyle #1}{\text{#3}} \quad #2 + } + + %MINIMIZATION ENVIRONMENTS + + \NewEnviron{mini}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation} + #6 + \bodyobjUn{#2}{#3}{minimize}{#7} + \end{equation} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{equation} + #6 + \begin{alignedat}{3} + \bodyobjOne{#2}{#3}{minimize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignedat} + \end{equation} + }% + {% + \begin{equation} + #6 + \begin{alignedat}{4} + \bodyobj{#2}{#3}{minimize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignedat} + \end{equation} + }% + }% + } + + \NewEnviron{argmini}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation} + #6 + \bodyobjUn{#2}{#3}{arg min}{#7} + \end{equation} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{equation} + #6 + \begin{alignedat}{3} + \bodyobjOne{#2}{#3}{arg min}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignedat} + \end{equation} + }% + {% + \begin{equation} + #6 + \begin{alignedat}{4} + \bodyobj{#2}{#3}{arg min}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignedat} + \end{equation} + }% + }% + } + + \NewEnviron{mini*}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation*} + \bodyobjUn{#2}{#3}{minimize}{#7} + \end{equation*} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{alignat*}{3} + \bodyobjOne{#2}{#3}{minimize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat*} + }% + {% + \begin{alignat*}{5} + \bodyobj{#2}{#3}{minimize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat*} + }% + }% + } + + \NewEnviron{argmini*}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation*} + \bodyobjUn{#2}{#3}{arg min}{#7} + \end{equation*} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{alignat*}{3} + \bodyobjOne{#2}{#3}{arg min}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat*} + }% + {% + \begin{alignat*}{4} + \bodyobj{#2}{#3}{arg min}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat*} + }% + }% + } + + + \NewEnviron{mini!}[7]{% + \ifthenelse{\equal{#1}{1}}{% + \begin{subequations} + #6 + \begin{alignat}{3} + \bodyobjOne{#2}{#3}{minimize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat} + \end{subequations} + }% + {% + \begin{subequations} + #6 + \begin{alignat}{4} + \bodyobj{#2}{#3}{minimize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat} + \end{subequations} + }% + } + + \NewEnviron{argmini!}[7]{% + \ifthenelse{\equal{#1}{1}}{% + \begin{subequations} + #6 + \begin{alignat}{3} + \bodyobjOne{#2}{#3}{arg min}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat} + \end{subequations} + }% + {% + \begin{subequations} + #6 + \begin{alignat}{4} + \bodyobj{#2}{#3}{arg min}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat} + \end{subequations} + }% + } + + %MAXIMIZATION ENVIRONMENTS + + \NewEnviron{maxi}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation} + #6 + \bodyobjUn{#2}{#3}{maximize}{#7} + \end{equation} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{equation} + #6 + \begin{alignedat}{3} + \bodyobjOne{#2}{#3}{maximize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignedat} + \end{equation} + }% + {% + \begin{equation} + #6 + \begin{alignedat}{4} + \bodyobj{#2}{#3}{maximize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignedat} + \end{equation} + }% + }% + } + + \NewEnviron{argmaxi}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation} + #6 + \bodyobjUn{#2}{#3}{arg max}{#7} + \end{equation} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{equation} + #6 + \begin{alignedat}{3} + \bodyobjOne{#2}{#3}{arg max}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignedat} + \end{equation} + }% + {% + \begin{equation} + #6 + \begin{alignedat}{4} + \bodyobj{#2}{#3}{arg max}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignedat} + \end{equation} + }% + }% + } + + \NewEnviron{maxi*}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation*} + \bodyobjUn{#2}{#3}{maximize}{#7} + \end{equation*} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{alignat*}{3} + \bodyobjOne{#2}{#3}{maximize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat*} + }% + {% + \begin{alignat*}{5} + \bodyobj{#2}{#3}{maximize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat*} + }% + }% + } + + \NewEnviron{argmaxi*}[7]{% + \ifthenelse{\equal{#1}{0}}{% + \begin{equation*} + \bodyobjUn{#2}{#3}{arg max}{#7} + \end{equation*} + }% + {% + \ifthenelse{\equal{#1}{1}}{% + \begin{alignat*}{3} + \bodyobjOne{#2}{#3}{arg max}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat*} + }% + {% + \begin{alignat*}{4} + \bodyobj{#2}{#3}{arg max}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat*} + }% + }% + } + + + \NewEnviron{maxi!}[7]{% + \ifthenelse{\equal{#1}{1}}{% + \begin{subequations} + #6 + \begin{alignat}{3} + \bodyobjOne{#2}{#3}{maximize}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat} + \end{subequations} + }% + {% + \begin{subequations} + #6 + \begin{alignat}{4} + \bodyobj{#2}{#3}{maximize}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat} + \end{subequations} + }% + } + + \NewEnviron{argmaxi!}[7]{% + \ifthenelse{\equal{#1}{1}}{% + \begin{subequations} + #6 + \begin{alignat}{3} + \bodyobjOne{#2}{#3}{arg max}{#7}\\ + \bodyconstOne{#4}{#5} + \end{alignat} + \end{subequations} + }% + {% + \begin{subequations} + #6 + \begin{alignat}{4} + \bodyobj{#2}{#3}{arg max}{#7}\\ + \bodyconst{#4}{#5,} \\ + \BODY + \end{alignat} + \end{subequations} + }% + } +\end{verbatim} + +\end{document} |