Correct specification for piecewise linear approximation of the log

Hello,

I have the following non-linear problem:

If you are using OSQP directly (i.e. via the C interface), then you should gather all of your variables into a combined vector (z,u). The first constraint is then something like
[I \,\,\; \gamma_k P][z;u] \le \beta_k

The other constraints can be handled similarly. Note that :

  • equality constraints can be imposed by setting left and right hand limits equal, e.g. in the form b \le x \le b
  • For one sided bounds, you can use a positive or negative infinite value on the other side, e.g. b \le x \le \infty or -\infty \le x \le b.

If you are doing this in C, then it is best to use the defined value OSQP_INFTY as the infinite value. In Matlab you can just use Inf, or (better) osqp.constant('OSQP_INFTY'). Similar things work through the other interfaces.

Note that if you are using an interface like Matlab/Python/Julia, then none of the above is really necessary. Instead, it is generally easier to use CVX / CVXPY / JuMP to model the problem directly as you have it here, and then let the parser convert it into the correct format for you.