3

Hi i read the optidef guide but i can't write properly my mixed integer linear problem in overleaf, the constraints are unaligned and it doesn't shows the number between parenthese for all the constraints. Also i don't know if I can refer to each constraint in the text like with the \ref{} method used for the sections

\documentclass[11pt,a4paper]{article}
\usepackage[short]{optidef}
\begin{document}
\begin{mini} {}{C_{\text{max}}}{}{} 
\addConstraint{\sum_{k \in M_j} X_{ijk}}{= 1,}{\quad \forall i \in J, \forall j \in O_i\label{eq:1}}
\addConstraint{S_{ijk} + C_{ijk}}{\leq X_{ijk}\cdot L,}{\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j \label{eq:2}} 
\addConstraint{C_{ijk}}{\geq S_{ijk} + t_{ijk} - (1 - X_{ijk}) \cdot L,}{\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j \label{eq:3}} 
\addConstraint{S_{ijk}}{\geq C_{i’j’k} - (Y_{iji’j’k}) \cdot L,}{\quad \forall i < i’, \forall j \in O_i, \forall j’ \in O_{i’}, \forall k \in M_j \cap M_{j’} \label{eq:4}} 
\addConstraint{S_{i’j’k}}{\geq C_{ijk} - (1 - Y_{iji’j’k}) \cdot L,}{\quad \forall i < i’, \forall j \in O_i, \forall j’ \in O_{i’}, \forall k \in M_j \cap M_{j’} \label{eq:5}} 
\addConstraint{\sum_{k \in M_j} S_{ijk}}{\geq \sum_{k \in M_j} C_{i,j-1,k},}{\quad \forall i \in J, \forall j \in O_i \setminus {O_{if(i)}} \label{eq:6}} 
\addConstraint{C_i}{\geq \sum_{k \in M_j} C_{i,O_{il_{(i)}},k},}{\quad \forall i \in J \label{eq:7}} 
\addConstraint{C_{\text{max}}}{\geq C_i,}{\quad \forall i \in J \label{eq:8}} \addConstraint{X_{ijk}}{\in {0, 1},}{\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j} 
\addConstraint{S_{ijk}, C_{ijk}, C_i}{\geq 0,}{\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j} 
\addConstraint{Y_{iji’j’k}}{\in {0, 1},}{\quad \forall i < i’, \forall j \in O_i, \forall j’ \in O_{i’}, \forall k \in M_j \cap M_{j’}} 
\end{mini}
\end{document}

the output is this:

enter image description here

1 Answer 1

1

You seem to want mini!.

\documentclass[a4paper]{article}
\usepackage[margin=1cm,heightrounded]{geometry}
\usepackage[short]{optidef}
\begin{document}

\begin{mini!} {}{C_{\mathrm{max}}}{}{\notag}
\addConstraint{\sum_{k \in M_j} X_{ijk}}{= 1,}
  {\quad \forall i \in J, \forall j \in O_i\label{eq:1}}
\addConstraint{S_{ijk} + C_{ijk}}{\leq X_{ijk}\cdot L,}
  {\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j \label{eq:2}} 
\addConstraint{C_{ijk}}{\geq S_{ijk} + t_{ijk} - (1 - X_{ijk}) \cdot L,}
  {\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j \label{eq:3}} 
\addConstraint{S_{ijk}}{\geq C_{i'j'k} - (Y_{iji'j'k}) \cdot L,}
  {\quad \forall i < i', \forall j \in O_i, \forall j' \in O_{i'},
   \forall k \in M_j \cap M_{j'} \label{eq:4}} 
\addConstraint{S_{i'j'k}}{\geq C_{ijk} - (1 - Y_{iji'j'k}) \cdot L,}
  {\quad \forall i < i', \forall j \in O_i, \forall j' \in O_{i'},
   \forall k \in M_j \cap M_{j'} \label{eq:5}} 
\addConstraint{\sum_{k \in M_j} S_{ijk}}{\geq \sum_{k \in M_j} C_{i,j-1,k},}
  {\quad \forall i \in J, \forall j \in O_i \setminus {O_{if(i)}} \label{eq:6}} 
\addConstraint{C_i}{\geq \sum_{k \in M_j} C_{i,O_{il_{(i)}},k},}
  {\quad \forall i \in J \label{eq:7}} 
\addConstraint{C_{\mathrm{max}}}{\geq C_i,}
  {\quad \forall i \in J \label{eq:8}}
\addConstraint{X_{ijk}}{\in {0, 1},}
  {\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j} 
\addConstraint{S_{ijk}, C_{ijk}, C_i}{\geq 0,}
  {\quad \forall i \in J, \forall j \in O_i, \forall k \in M_j} 
\addConstraint{Y_{iji'j'k}}{\in {0, 1},}
  {\quad \forall i < i', \forall j \in O_i, \forall j' \in O_{i'},
   \forall k \in M_j \cap M_{j'}} 
\end{mini!}
\end{document}

enter image description here

It should be \mathrm{max} (or \max), not \text{max}.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .