# Numbering equations in an optimization problem

I am trying to assign numbers to my equations in an optimization problem, however Latex keeps giving one number for the single problem. I have checked multiple sources for any advice, but I have yet to find one satisfactory.

The model is as follows:

\begin{equation}

\begin{aligned}

& \underset{k=1, t\epsilon T, p\epsilon P}{\text{Max}}
& &\sum_{p\epsilon P}(a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t  \\

& \text{subject to}
& & f\sum_{ p\epsilon P}x_{p,t}+y_t=B_t , & \forall t \\

&&& k\geq m_k , & \forall k \\

&&& p_i\geq g_{pi,pj} , & \forall i \vee j && j \neq i \\

&&& \sum_{p\epsilon P}\sum_{t\epsilon T} (a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F \\

\end{aligned}

\end{equation}


I synthesize that the problem is due to me using only one equation format, but I've tried with several, but that only gave me errors.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Sep 21, 2017 at 15:04

Do you mean to use the align environment instead of the aligned environment? aligned creates only one equation number for the whole environment. align creates a separate equation number for each new line in the environment.

If you want to omit numbering on specific equations, you can do so with the \nonumber command. Try this code instead:

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\title{Equation Numbering}
\begin{document}
\maketitle

\begin{align}
& \underset{k=1, t\epsilon T, p\epsilon P}{\text{Max}}
& &\sum_{p\epsilon P}(a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t  \\
%
& \text{subject to}
& & f\sum_{ p\epsilon P}x_{p,t}+y_t=B_t , & \forall t \\
%
&&& k\geq m_k , & \forall k \nonumber \\
%
&&& p_i\geq g_{pi,pj} , & \forall i \vee j && j \neq i \nonumber \\
%
&&& \sum_{p\epsilon P}\sum_{t\epsilon T}
(a_{p,k,t}x_{p,t})+\sum_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F
\end{align}
\end{document}


Here is a solution with alignat:

    \documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\Max}{Max}

\begin{document}

\begin{alignat}{3}
& \underset{\substack{k=1, t ∈ T, \\ p ∈ P}}{\Max}\,
\mathrlap{∑_{p ∈ P}(a_{p,k,t}x_{p,t})+∑_{t=1}^{T}{(1+r)}^{T-t}y_t} \\
& \text{subject to}
& \quad & f∑_{ p ∈ P}x_{p,t}+y_t=B_t , & & \quad ∀ t \\
& & & k\geq m_k , & & ∀ k \\
& & & p_i\geq g_{pi,pj} , & & ∀ i ∨ j ,\quad j ≠ i \\
& & & ∑_{p ∈ P}∑_{t ∈ T} (a_{p,k,t}x_{p,t}) + \mathrlap{∑_{t=1}^{T}{(1+r)}^{T-t}y_t \geq B_F }
\end{alignat}

\end{document} 