3

I am writing to assign numbers to my equations in an optimization problem. However, Latex keeps giving one number for the single problem. How can to write it?

My code is

\begin{equation}
\begin{aligned} 
& \underset{\mathbf{x}}{\text{maximize}}
& & \sum_{m}^{M} \sum_{k}^{K} \sum_{n}^{N} R_{m,k,n}^{T,UL} x_{m,k,n}  \\
& \text{subject to}
& & \sum_{m}^{M} \sum_{k}^{K} x_{m,k,n} \leq 1, \; \forall n. \\
& & & \sum_{n}^{N} x_{m,k,n} \leq 1, \; \forall m,k. 
\end{aligned}
\end{equation}   
  • So, do you want three equation numbers? Please advise. – Mico Oct 7 '17 at 23:05
  • @Mico yes, maybe 1, 2 and 3 or 1, 1c and 1d. Thanks a lot – user3727281 Oct 7 '17 at 23:07
6

Here are two possible solutions. Note that I've reduced the number of alignment points relative to your original code. In the second solution, only the two constraint equations are aligned relative to each other.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for align environment
\usepackage{bm}      % for \bm macro
\begin{document}

First possibility:
\begin{align} 
\max_{\bm{x}} \quad
& \sum_{m=1}^{M} \sum_{k=1}^{K} \sum_{n=1}^{N} R_{m,k,n}^{T,\mathit{UL}} x_{m,k,n}  \\
\text{subject to}\quad
&\sum_{m=1}^{M} \sum_{k=1}^{K} x_{m,k,n} \leq 1 \quad \forall n \\
&\sum_{n=1}^{N} x_{m,k,n} \leq 1 \quad \forall m,k. 
\end{align} 

Second possibility:
\begin{equation} 
\max_{\bm{x}} \quad
\sum_{m=1}^{M} \sum_{k=1}^{K} \sum_{n=1}^{N} R_{m,k,n}^{T,\mathit{UL}} x_{m,k,n} 
\end{equation}
\begin{subequations}
\begin{align}
\text{subject to}\quad
&\sum_{m=1}^{M} \sum_{k=1}^{K} x_{m,k,n} \leq 1 \quad \forall n \\
&\sum_{n=1}^{N} x_{m,k,n} \leq 1 \quad \forall m,k. 
\end{align} 
\end{subequations}
\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.