3

I am writing the following optimization model:

\documentclass[preprint,3p,times,onecolumn]{elsarticle}

\usepackage[fleqn]{amsmath}
\usepackage{mathrsfs}

\begin{document}
\begin{align}
    & \mathcal{L} \left( \boldsymbol{p}, \boldsymbol{r}^{U}, \boldsymbol{r}^{D}; \tilde{\boldsymbol{g}} \right) = \max_{\substack{\boldsymbol{a}^{G}, \boldsymbol{a}^{L}, \boldsymbol{\beta}, \boldsymbol{\gamma}, \\ \underline{\boldsymbol{\pi}}, \overline{\boldsymbol{\pi}}, \underline{\boldsymbol{\sigma}}, \overline{\boldsymbol{\sigma}}}} ~ \sum_{b \in \mathscr{N}} \beta_{b} \left( D_{b} - \tilde{g}_{b} \right) - \sum_{l \in \mathscr{L}} \overline{F}_{l} \left( \underline{\pi}_{l} + \overline{\pi}_{l} \right) + \sum_{i \in \mathscr{I}} \left[ \underline{\sigma}_{i} \left( a_{i}^{G} \left( p_{i} - r_{i}^{D} \right) \right) - \overline{\sigma}_{i} \left( a_{i}^{G} \left( p_{i} + r_{i}^{U} \right) \right) \right]  \label{eq01:LOL_Func_SL} \\
    & \hspace{2.20cm} \text{subject to:} \notag \\
    & \hspace{2.20cm} \beta_{b} + \underline{\sigma}_{i} - \overline{\sigma}_{i} \leq 0, && \hspace{-4.50cm} \forall ~ b \in \mathscr{N}, i \in \mathscr{I}_{b}; \label{eq03:LOL_Func_SL} \\
    & \hspace{2.20cm} \beta_{to(l)} - \beta_{fr(l)} + \gamma_{l} + \underline{\pi}_{l} - \overline{\pi}_{l} = 0, && \hspace{-4.50cm} \forall ~ l \in \mathscr{L}; \label{eq04:LOL_Func_SL}
\end{align}
\end{document}

I want to align all $\forall$ operators but since the objective function is too big, I need to use a negative "\hspace". Is there a way around?enter image description here

3

With alignat and small manual tweaking:

enter image description here

\documentclass[preprint,3p,times,onecolumn]{elsarticle}

\usepackage[fleqn]{amsmath}
\usepackage{mathrsfs}

    \begin{document}
\begin{alignat}{3}
\mathcal{L} \left(\boldsymbol{p}, \boldsymbol{r}^{U}, \boldsymbol{r}^{D}; \tilde{\boldsymbol{g}} \right)\  
    & = \max_{\substack{
              \boldsymbol{a}^{G},\boldsymbol{a}^{L}, \boldsymbol{\beta},\boldsymbol{\gamma}, \\
              \underline{\boldsymbol{\pi}}, \overline{\boldsymbol{\pi}}, \underline{\boldsymbol{\sigma}}, \overline{\boldsymbol{\sigma}}
                        }} 
        \sum_{b \in \mathscr{N}} \beta_{b} \left(D_{b} - \tilde{g}_{b} \right) -
        \sum_{l \in \mathscr{L}} \overline{F}_{l} 
                \left( \underline{\pi}_{l} + \overline{\pi}_{l} \right) +
       &&  \hspace{-0.2em}
                \sum_{i \in \mathscr{I}} 
                \left[ \underline{\sigma}_{i} 
                \left( a_{i}^{G} \left( p_{i} - r_{i}^{D} \right) \right) - \overline{\sigma}_{i} \left( a_{i}^{G} \left( p_{i} + r_{i}^{U} \right) \right) \right]  \\%\label{eq01:LOL_Func_SL} \\
%
    &   \text{subject to:}
        &&   \notag \\ 
%
    &   \beta_{b} + \underline{\sigma}_{i} - \overline{\sigma}_{i} \leq 0,
        &&  \forall ~ b \in \mathscr{N}, i \in \mathscr{I}_{b};
            \label{eq03:LOL_Func_SL}  \\%
%
    &   \beta_{to(l)} - \beta_{fr(l)} + \gamma_{l} + \underline{\pi}_{l} - \overline{\pi}_{l} = 0,
        &&  \forall ~ l \in \mathscr{L};
            \label{eq04:LOL_Func_SL}                               
\end{alignat}
    \end{document}

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.