I have an optimization problem as below

\begin{align} \max_x&\quad x\sum_{k=1}^{K}\log\left(1+\frac{h_k}{x}\right)+{(1-x) \sum_{l=1}^L \log\left(1+\frac{g_l}{1-x}\right)}\\\text { subject to }&\quad0 < x < 1 \hspace{0.7cm}\\&\quad Q(x)\leq 0 \end{align}

Is it possible use slack variables to reform it (actually first constraint) in a standard format? (I'm aiming to rewrite it as a standard problem and then attempt to find a closed-form solution using the Lagrangian method.)

  • 2
    $\begingroup$ What about $\varepsilon \leq x \leq 1 - \varepsilon$, where $\varepsilon > 0$ is a (small) numerical tolerance constant? $\endgroup$
    – joni
    Jan 20 at 16:18
  • $\begingroup$ Thanks, should I define epsilon as a new constraint? $\endgroup$
    – RG.A
    Jan 20 at 17:02
  • 1
    $\begingroup$ Also, I would suggest looking into disciplined convex programming.. See dcp.stanford.edu -- it helped me reduce the number of iterations to reach optimal solutions for my non-linear problems. $\endgroup$ Jan 24 at 22:18

1 Answer 1


You should take a look at the Karush-Kuhn-Tucker conditions (aka KKT conditions) as an alternative to Lagrange multipliers. As noted in the comment by @joni, you can pick a small positive number $\epsilon > 0$ (this is a parameter, not a variable to be constrained) and rewrite your first constraint as $$\begin{align*}x & \le 1-\epsilon \\ -x & \le -\epsilon.\end{align*}$$ How small $\epsilon$ should be depends on how close to 0 or 1 you want to allow $x$ to get, with the qualification that too small a value can result in numerical issues.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.