Optimization problem

I am a newbie to LaTeX and would like to write this optimization problem using LaTeX code:

I would very appreciate it if someone could help me.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Feb 21 '18 at 3:58

Just to give you a starting point. This is how I may type this in TeX.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\var}{var}
\begin{document}
$\underset{w1,w2\cdots w_{20}}{\text{min}/\text{max}}\,w^TCw \quad\text{subject to}\begin{cases} (1) & w_1+w_2+\cdots +w_{20}=100\%\\ (2) & 0\%\le w_i\le100\%\quad\forall i=1,2,\dots 20 \end{cases}$

$\max_{w1,w2\cdots w_{20}}E[w_1R_1+w_2R2+\cdots+w_{20}R{20}] \quad\text{subject to}\begin{cases} (1) & \sqrt{\var[w_1R_1+\cdots+w_{20}R_{20}]}\le \sigma_\mathrm{max}\\ (2) & w_1+w_2+\cdots +w_{20}=100\%\\ (3) & \ell_i\le w_i\le u_i\quad\forall i=1,2,\dots 20 \end{cases}$
\end{document}

• Thank you so much for your help. I was just wondering if you could one more time writing LaTeX.... this is so hard lol. Feb 21 '18 at 15:16
• @JunJang Sorry, I don't understand " I was just wondering if you could one more time writing ". What precisely am I supposed to do?
– user121799
Feb 21 '18 at 15:18
• Oh sorry. I meant "I was just wondering if you could help me one more time writing LaTeX". sorry for the confusion! Feb 21 '18 at 15:19
• @JunJang Sure. But what?
– user121799
Feb 21 '18 at 15:19
• I just added a new capture in the post. I would like to write the optimization problem in LaTex code too. Feb 21 '18 at 15:21