I would like to format an optimization problem by
\documentclass{article}
\usepackage{amsmath}
\begin{document}
We want to label each line separately. The inserted text and formulas
have to be aligned like in this example:
\begin{equation}
\begin{aligned}
\label{eq:3}
& \underset{X}{\text{minimize}} & & \mathrm{trace}(X) \\
& \text{subject to} && X_{ij} = M_{ij}, \; (i,j) \in \Omega, \\
& && X \succeq 0.
\end{aligned}
\end{equation}
\end{document}

(Already described in How to label an optimization problem with a label such as (P)?).
An ideal alignment of the inserted text and formulas is achieved by the aligned environment. However, I want to label each line separately. By placing \label{...} at each line
\begin{equation}
\begin{aligned}
& \underset{X}{\text{minimize}} & & \mathrm{trace}(X) \label{eq:6}\\
& \text{subject to} && X_{ij} = M_{ij}, \; (i,j) \in \Omega, \label{eq:7} \\
& && X \succeq 0. \label{eq:9}
\end{aligned}
\end{equation}
I get the error message: "Package amsmath Error: Multiple \label's: label 'eq:4' will be lost."
How can I label each line individually?

alignenvironment instead ofequationandalignedwill work:\begin{align} & \max \sum p_t s_t \label{eq:3}\& \text{s.t. } s_t \leq d_t \label{eq:4}\& \sum s_t \leq I \label{eq:5} \end{align}– Peter Grill Mar 23 '13 at 09:14