2

I want to write an optimization problem wherein I want the "number" to be something like "PP".

The code below achieves this in the align environment.

\begin{aligned}
& \underset{x}{\text{minimize}}
& & f_0(x) \label{Eq:PP} \tag{PP} \\
& \text{subject to}
& & f_i(x) \leq b_i, \; i = 1, \ldots, m.
\end{aligned}
\end{align}

However, doing that produces (PP) on the first line of the equation. I can use

\begin{aligned}
& \underset{x}{\text{minimize}}
& & f_0(x) \label{Eq:PP}\\
& \text{subject to}
& & f_i(x) \leq b_i, \; i = 1, \ldots, m.
\end{aligned}
\end{equation}

Here, the number appears in the center, as it should, but if I try "tag{PP}", I get an error. I was wondering if there's a way to write the optimization problem so that the number "PP" appears is vertically at the enter of the problem, and not aligned with the first line.

Thanks!

4

The label and tag had to be outside of aligned environment:

\documentclass{article}
\usepackage{amsmath}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{equation}
\setlength\PreviewBorder{1em}

\begin{document}
    \begin{equation} \label{Eq:PP} \tag{PP} 
\begin{aligned}
    & \underset{x}{\text{minimize}}
        & & f_0(x) \\
    & \text{subject to}
        & & f_i(x) \leq b_i, \; i = 1, \ldots, m.
\end{aligned}
    \end{equation}
\end{document}

enter image description here

| improve this answer | |
  • That's great! Thanks. – avk255 Aug 30 at 8:12
2

I use another approach using optidef package that it is a library for optimization problems. The inconvenience of this package, IMHO, are the labels (in fact I have not able to put the label into the two equation or it is impossible).

\documentclass[a4paper,12pt]{article}

\usepackage{mathtools,amssymb}
\usepackage{optidef}
\begin{document}

\begin{mini!}
{x}{f_0(x)}{}{}\notag
\addConstraint{f_i(x) }{\leq b_i,\quad}{ i = 1, \ldots, m.}\tag{PP}
\end{mini!}

\end{document}

enter image description here

| improve this answer | |

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.