# Showing optimization problems side by side

I would like to show two optimization problems side by side with an equivalence arrow in the middle of them. I have already tried (see the code below) using an align environment, but I can't deal with the constraints. I would like to have the constraints directly below the objective function, but as you can see, one constraint doesn't fit my requirement. Furthermore I would like to show the "left" problem flush-left and the "right" problem flush-right. Maybe one of you could help me. Thanks in advance! My code:

\documentclass[12pt, oneside]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[english]{babel}
\makeatletter
\newcommand\flausr{\@fleqntrue}
\makeatother
\begin{document}
\begingroup
\flausr
\begin{align}
&\max_{c^{1}_{1},c^{2}_{2}}  \mathbb{E}(u(c^{1}_{1},c^{2}_{2}) & \hspace{2.5cm} \iff & \max_{c^{1}_{1},c^{2}_{2}} \pi_{1} u(c^{1}_{1}) + (1-\pi_{1}) \rho u(c^{2}_{1} + c^{2}_{2})\\
\mathrm{s.t.} &\, c^{1}_{1}=(1-I) + pRI &  \mathrm{s.t.} c^{1}_{1}=pc^{2}_{2} \notag \\
& \,c^{2}_{2}=\dfrac{(1-I)}{p}+RI \notag
\end{align}
\endgroup
\end{document}


By compiling the code, one gets: ## Edit after first answer :

First of all, thank you for your answers! But I still have one question. Maybe I described it wrongly in my original post: I would like to have the objective function of the "right" problem flush-right, but not the constraints. Is it possible to obtain a depiction, in which the constraints are shown below the objective function like in the "left" problem in my former post?

• Welcome to TeX.SX ! Have you thought about using a tabular environment, especially, if you want to fill the page linewidth, a tabularx ? – marsupilam Jun 2 '17 at 18:11
• @marsupilam care to expand that remark into a full answer? – Moriambar Jun 2 '17 at 18:17
• @Moriambar Your wishes are my commands ! – marsupilam Jun 2 '17 at 18:30

# Edited

This is more subtle : does the following help ?

Basically, here I am performing thusly by nesting array environments with suitable alignments.

I deal with the excess complexity by defining commands for each optimization problem.

### The output ### The code

\documentclass[12pt,oneside]{article}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\newcommand\E{\mathbb{E}}
\begin{document}
\newenvironment{myOptPb}
{% before
\bgroup
\def\arraystretch{1.3}
\begin{array}[t]{l}
}
{% after
\end{array}
\egroup
}
\def\myFirstOptPb
{
\begin{myOptPb}
\max\limits_{c^{1}_{1},c^{2}_{2}}  \E\big[u(c^{1}_{1},c^{2}_{2})\big] \\
\text{s.t. } c^{1}_{1}=(1-I) + pRI                                    \\
\end{myOptPb}
}
\def\mySecondOptPb
{
\begin{myOptPb}
\max\limits_{c^{1}_{1},c^{2}_{2}} \pi_{1} u(c^{1}_{1}) + (1-\pi_{1}) \rho u(c^{2}_{1} + c^{2}_{2}) \\
\text{s.t. \quad } c^{1}_{1}=pc^{2}_{2}                                                            \\[3mm]
\text{with : \quad } c^{2}_{2}=\dfrac{(1-I)}{p}+RI                                                 \\
\end{myOptPb}
}
\def\myThirdOptPb
{
\begin{myOptPb}
\text{if } f(x) = x^2          \\
\text{then } f'(x) = 2 \cdot x \\
\end{myOptPb}
}

\thispagestyle{empty}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
\begin{align*}
\def\arraystretch{3}
\begin{array}{l@{\hspace{1cm}}c@{\hspace{1cm}}r}
\myFirstOptPb & \Longleftrightarrow & \mySecondOptPb \\
\myThirdOptPb & \Longleftrightarrow & \myThirdOptPb  \\
\end{array}
\end{align*}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
\end{document}


# Original

Here is one classic way to do stuff like this.

Hope I didn't misunderstand the layout you wanted

If you have some further questions, ask away !

### The output ### The code

\documentclass[12pt,oneside]{article}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\newcommand\E{\mathbb{E}} % so we don't have to type that too many times
\begin{document}
\thispagestyle{empty}     % avoid pesky page numbering
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
\begin{align*}            % we are in math mode, we use an array environment
\def\arraystretch{1.3}  % increase line spread by 30 percent : sage advice from Moriambar
\begin{array}{l@{\hspace{1cm}}c@{\hspace{1cm}}r} % 3 columns : l[eft] c[entered] r[ight] aligned with 1cm between each
\max\limits_{c^{1}_{1},c^{2}_{2}}  \E\big[u(c^{1}_{1},c^{2}_{2})\big] & \Longleftrightarrow & \max\limits_{c^{1}_{1},c^{2}_{2}} \pi_{1} u(c^{1}_{1}) + (1-\pi_{1}) \rho u(c^{2}_{1} + c^{2}_{2}) \\
\text{s.t. } c^{1}_{1}=(1-I) + pRI                                    &                     & \text{s.t. \quad } c^{1}_{1}=pc^{2}_{2}                                                            \\ [3mm]
&                     & \text{with : \quad } c^{2}_{2}=\dfrac{(1-I)}{p}+RI                                                 \\
\end{array}
\end{align*}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla
\end{document}


Cheers,

• Nice; I would increase the arraystretch and also look into the missing space in the last row – Moriambar Jun 2 '17 at 18:32