
Align 환경을 사용하여 ILP 모델을 작성했는데 번호 매기기가 잘못되었습니다. 각 숫자가 제약 조건을 따르는 대신 모든 제약 조건이 있고 끝에 모든 숫자가 있습니다. 다른 문서에서 동일한 코드를 사용하면 제대로 작동합니다. 무엇이 문제일까요?
\begin{align}
\mbox{min.} \quad & \sum_{p \in P} \sum_{(t_{1},v_{1},t_{2},v_{2}) \in WT} c_{v_{1},v_{2}}x^p_{t_{1},v_{1},t_{2},v_{2}} \notag \\
\mbox{s.t.} \quad
& \sum_{(t_{2},v_{2},t_{1},v_{1}) \in BS(t_{1},v_{1})} x^p_{t_{2},v_{2},t_{1},v_{1}} - \sum_{(t_{1},v_{1},t_{2},v_{2}) \in FS(t_{1},v_{1})} x^p_{t_{1},v_{1},t_{2},v_{2}}\; = \; 0\qquad \forall p \in P,(v_{1},t_{1}) \in VT \\
& - \sum_{(p,o,t_{2},v_{2}) \in FS(p,o)} x^p_{p,o,t_{2},v_{2}}\; = \; - d_p \qquad \forall p \in P\\
& \sum_{(t_{1},v_{1},p,w) \in BS(p,w)} x^p_{t_{1},v_{1},p,w} \; = \; + d_p \qquad \forall p \in P\\
& \sum_{p \in P} \sum_{(t_{2},v_{2},t_{1},v_{1}) \in BS(t_{1},v_{1})} x^p_{t_{2},v_{2},t_{1},v_{1}} \; \leq \; Q \qquad\qquad\qquad\qquad\qquad\qquad\qquad\forall (v_{1},t_{1}) \in VT \\
& x^p_{t_{1},v_{1},t_{2},v_{2}} \in Z \qquad \qquad \qquad \qquad \qquad \quad \forall p \in P, \forall (t_{1},v_{1},t_{2},v_{2}) \in WT
\end{align}\\
\\
답변1
alignat{2}
환경 에 환경을 삽입하는 것이 좋습니다 gather*
. 두 환경 모두 amsmath
패키지에 의해 자동으로 로드되는 패키지에 의해 제공됩니다 mathtools
. 또한 \smashoperator
매크로(패키지에서 제공 mathtools
)를 사용하여 일부 \sum
지시문 아래의 자료를 보다 간결하게 조판할 것입니다.
\documentclass{article} % or some other suitable document class
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters as needed
\usepackage{mathtools} % for '\smashoperator' macro
\newcommand\vn[1]{\mathit{#1}}
\begin{document}
\begin{gather*}
\min \sum_{p \in P\mathstrut} \
\smashoperator[r]{\sum_{(t_{1},v_{1},t_{2},v_{2}) \in \vn{\vn{WT}}} }
c_{v_{1},v_{2}}x^p_{t_{1},v_{1},t_{2},v_{2}} \\
\shortintertext{such that}
\begin{alignat}{2}
\smashoperator{\sum_{(t_{2},v_{2},t_{1},v_{1}) \in \vn{BS}(t_{1},v_{1})}}
x^p_{t_{2},v_{2},t_{1},v_{1}}
\quad-\quad
\smashoperator{\sum_{(t_{1},v_{1},t_{2},v_{2}) \in \vn{FS}(t_{1},v_{1})}}
x^p_{t_{1},v_{1},t_{2},v_{2}}
&= 0
&\qquad&\forall p \in P,\ \forall(v_{1},t_{1}) \in \vn{VT} \\
-\smashoperator{\sum_{(p,o,t_{2},v_{2}) \in \vn{FS}(p,o)}}
x^p_{p,o,t_{2},v_{2}}
&= -d_p
&&\forall p \in P \\
\smashoperator{\sum_{(t_{1},v_{1},p,w) \in \vn{BS}(p,w)}}
x^p_{t_{1},v_{1},p,w}
&= + d_p
&&\forall p \in P\\
\sum_{p \in P\mathstrut} \
\smashoperator[r]{\sum_{(t_{2},v_{2},t_{1},v_{1}) \in \vn{BS}(t_{1},v_{1})}}
x^p_{t_{2},v_{2},t_{1},v_{1}}
&\leq Q
&&\forall (v_{1},t_{1}) \in \vn{VT} \\
x^p_{t_{1},v_{1},t_{2},v_{2}} &\in Z
&& \forall p \in P,\
\forall (t_{1},v_{1},t_{2},v_{2}) \in \vn{WT}
\end{alignat}
\end{gather*}
\end{document}
부록: 이러한 방정식을 작성하기가 지루하고 독자로서 이해하기가 전혀 쉽지 않은 이유 중 상당 부분은 합계-아래 첨자 위치에 4-튜플이 존재하기 때문입니다. 이러한 튜플에 대한 약어를 생성하고 \tau_1
이중 \tau_4
합계 표기법을 사용하는 것이 괜찮다면 방정식을 다음과 같이 다시 작성할 수 있습니다.
\documentclass{article}
\usepackage{mathtools} % for '\smashoperator' macro
\newcommand\vn[1]{\mathit{#1}}
\newcommand\doublesum{\mathop{\sum\sum}}
\begin{document}
\begin{gather*}
\min \smashoperator{\doublesum_{p \in P,\;\tau_1\in\vn{WT}}}
c^{}_{v_{1},v_{2}}x^p_{\tau_1} \\
\intertext{such that}
\begin{alignat}{2}
\smashoperator{\sum_{\tau_1\in\vn{FS}(\tau)}}
x^p_{\tau_1}
&=
\smashoperator[r]{\sum_{\tau_2\in\vn{BS}(\tau)}}
x^p_{\tau_2}
&\quad&
\forall p \in P,\ \forall\tau\in\vn{VT} \\
-\smashoperator{\sum_{\tau_3\in\vn{FS}(p,o)}}
x^p_{\tau_3}
&= -d_p
&&\forall p \in P \\
\smashoperator{\sum_{\tau_4\in\vn{BS}(p,w)}}
x^p_{\tau_4}
&= +d_p
&&\forall p \in P \\
\smashoperator{\doublesum_{p \in P,\;\tau_2\in\vn{BS}(\tau)}}
x^p_{\tau_2}
&\leq Q
&&\forall \tau\in\vn{VT} \\
x^p_{\tau_1} &\in Z
&& \forall p \in P,\ \forall \tau_1\in\vn{WT}
\end{alignat}
\end{gather*}
where $\tau\equiv(t_{1},v_{1})$,
$\tau_1\equiv(t_{1},v_{1},t_{2},v_{2})$,
$\tau_2\equiv(t_{2},v_{2},t_{1},v_{1})$,
$\tau_3\equiv(p,o,t_{2},v_{2})$, and
$\tau_4\equiv(t_{1},v_{1},p,w)$.
\end{document}