How to rewrite this problem in a standard format?

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.)

• What about $\varepsilon \leq x \leq 1 - \varepsilon$, where $\varepsilon > 0$ is a (small) numerical tolerance constant?
– joni
Jan 20 at 16:18
• Thanks, should I define epsilon as a new constraint?
– RG.A
Jan 20 at 17:02
• 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. Jan 24 at 22:18

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.