[Tex/LaTex] How to align multiline equations

alignmentequations

I am working with equations that are should be broken to multiple lines. The code I wrote is as follows:

\begin{equation}
\begin{aligned}
     O_{max} = w_1 \Sigma_{a=1}^{m} \Sigma_{b=a+1}^{n} (-\left|CPT_a 
     - CPT_b\right|)\\ 
     & + w_2 \Sigma_{j=1}^{m} (DIF_j) + w_3 \Sigma_{j=1}^{m} 
    (INT_j/\Sigma_{x=1}^{n} x_{ij})
\end{aligned}
\label{equ:ho}
\end{equation}

and the other one is

 \begin{align} 
    \begin{split}
     nr(G_i,r) = 
     \begin{cases}
         1 &  \text{r is naturally played by one member of $G_i$}\\
         -2 &  \text{r is not naturally played in $G_i$} \\
         -p & \text{r is naturally played by p members in $G_i$}\\
     \end{cases}
   \end{split} \nonumber \\ 
   \begin{split}
      nb(G_i) = \Sigma_{r=1}^{9} nr(G_i,r)\\ 
      & max_{\forall G\in C} \left( b(G) = 
      \frac{\Sigma_{i=1}^{g}nb(G_i)}{g}\right)
   \end{split}
   \label{equ:yannibelli}       
 \end{align}

Alignment of each equation is not the same (second part goes to the right and out of the margin of the pages). How can I fix them, please??

Best Answer

EDIT: 2020/01/01 for the comment of the user @Mico. The first alignment with the important suggestion of the user @Sigur is:

enter image description here

\documentclass[a4paper,12pt]{article}
    \usepackage{amsmath,amssymb}
    \begin{document}
    \begin{equation}
    \begin{aligned}
     O_{\max}& = w_1 \sum_{a=1}^{m} \sum_{b=a+1}^{n} (-\lvert\text{CPT}_a 
         -\text{CPT}_b\rvert)\\ 
         &\quad + w_2 \sum_{j=1}^{m} (\text{DIF}_j) + w_3 \sum_{j=1}^{m} 
        (\text{INT}_j/\sum_{x=1}^{n} x_{ij})
    \end{aligned}
    \label{equ:ho}
    \end{equation}
    \end{document}

For the second code my proposal to align is:

enter image description here

    \documentclass[a4paper,12pt]{article}
    \usepackage{amsmath,amssymb}
    \begin{document}
    \[\begin{aligned} 
         \mathrm{nr}(G_i,r) & = 
         \begin{cases}
             1 &  \text{$r$ is naturally played by one member of $G_i$}\\
             -2 &  \text{$r$ is not naturally played in $G_i$} \\
             -p & \text{$r$ is naturally played by $p$ members in $G_i$}\\
         \end{cases}\\[3pt]
        \mathrm{nb}(G_i) & = \sum_{r=1}^{9} \mathrm{nr}(G_i,r)\\ 
          & = \max_{\forall G\in C} \left( b(G) = \frac{\sum\limits_{r=1}^{9}\mathrm{nb}(G_i)}{g}\right)
          \label{equ:yannibel}
       \end{aligned} 
       \]
    \end{document}