Optimization using KKT of a 3 variable function

385 Views Asked by At

I want to maximize the function : $$\sum_{i=0}^n x_i*ln(1+ \frac{ c*y_i*z_i }{x_i})$$ subject to : $$\sum_{i=0}^n x_i \le X_0 \;\;\;\;\;\;\; and \;\;\;\;\;\;\; \sum_{i=0}^n y_i \le Y_0 $$ $$ x_i \; and \; y_i \; and \; z_i \; are \; Non-negative \;\;\;\;\;\;\;\;\;\;\;\;\;\; c \; and \; X_0 \; and \; Y_0 \; are \ positive \; constants $$ It is required to form the lagrangian, use KKT conditions and get $ x_i \; and \; y_i \; in \; terms \; of \; z_i $ if possible

I formed the lagrangian as follows : $ $ $$ \sum_{i=0}^n x_i*ln(1+ \frac{ c*y_i*z_i }{x_i}) +\lambda_1*(X_0 - \sum_{i=0}^n x_i) \; +\lambda_2*(Y_0 - \sum_{i=0}^n y_i) $$ I differentiated w.r.t. y and equated the derivative to zero to get $$ x*\frac{ \frac{c*z}{x} }{ 1+\frac{c*y*z}{x} } -\lambda_2 = 0 $$ then w.r.t. z to get ( which seems trivial ) $$ x*\frac{ \frac{c*y}{x} }{ 1+\frac{c*y*z}{x} } = 0 $$ and finally w.r.t x to get $$ ln(1+ \frac{ c*y_i*z_i }{x_i}) + x*\frac{ \frac{-c*y*z}{x^2} }{1+\frac{c*y*z}{x}} -\lambda_1 =0 $$ Am I right so far and shall continue ? as I am still a beginner. Thanks in advance

1

There are 1 best solutions below

3
On

Since you are only optimizing over $x=(x_1,x_2,\dots,x_n)$ and $y=(y_1,y_2,\dots,y_n)$ based on your above comment, the optimization problem has $2n$ variables. Writing it in minimization form, \begin{align*} &\text{minimize} && f(x,y) = -\sum_{i=1}^n x_i\log\left( 1 + \frac{cz_i y_i}{x_i} \right) \\ &\text{subject to} && \mathbf{1}^\top x \le X_0, \\ &&& \mathbf{1}^\top y \le Y_0, \\ &&& x \ge 0, ~ y\ge 0, \end{align*} where $c,X_0,Y_0\in\mathbb{R}$ and $z\in\mathbb{R}^n$ are given, and $\mathbf{1}$ denotes the $n$-vector of all ones. The Lagrangian for this problem is \begin{equation*} L(x,y,\lambda,\mu,\nu,\eta) = f(x,y) + \lambda(\mathbf{1}^\top x - X_0) + \mu(\mathbf{1}^\top y - Y_0) - \nu^\top x - \eta^\top y. \end{equation*} Now, the Lagrangian stationarity condition of KKT requires us to differentiate $L$ with respect to $x$ and $y$. To do so, note that \begin{align*} \frac{\partial f}{\partial x_j}(x,y) ={}& - \sum_{i=1}^n \left( \frac{\partial x_i}{\partial x_j}\log\left( 1+\frac{cz_i y_i}{x_i} \right) - x_i\frac{1}{1+\frac{cz_i y_i}{x_i}} \frac{cz_iy_i}{x_i^2}\frac{\partial x_i}{\partial x_j}\right) \\ ={}& -\left( \log\left( 1+\frac{cz_jy_j}{x_j} \right) - \frac{1}{1+\frac{cz_jy_j}{x_j}}\frac{cz_jy_j}{x_j} \right), \end{align*} for $j\in\{1,2,\dots,n\}$. Taking a similar approach for differentiating with respect to $y$, we find that \begin{equation*} \frac{\partial f}{\partial y_j}(x,y) = -x_j\frac{1}{1+\frac{cz_jy_j}{x_j}}\frac{cz_j}{x_j} = - \frac{cz_j}{1+\frac{cz_jy_j}{x_j}}. \end{equation*} Now, putting these partial derivatives into vectors, we can write the gradient of $f$ in short form: \begin{align*} \nabla_x f(x,y) ={}& \left( \frac{\partial f}{\partial x_1}(x,y),\frac{\partial f}{\partial x_2}(x,y),\dots,\frac{\partial f}{\partial x_n}(x,y) \right), \\ \nabla_y f(x,y) ={}& \left( \frac{\partial f}{\partial y_1}(x,y),\frac{\partial f}{\partial y_2}(x,y),\dots,\frac{\partial f}{\partial y_n}(x,y) \right). \end{align*} With these gradients known, the Lagrangian stationarity condition becomes \begin{align*} \nabla_xL(x^*,y^*,\lambda,\mu,\nu,\eta) ={}& \nabla_x f(x^*,y^*) + \lambda\mathbf{1} - \nu = 0, \\ \nabla_yL(x^*,y^*,\lambda,\mu,\nu,\eta) ={}& \nabla_y f(x^*,y^*) + \mu\mathbf{1} - \eta = 0, \end{align*} which looks similar to your result aside from your missing Lagrange multiplier associated with the nonnegativity constraints and your indexing notation.