0
$\begingroup$

My goal is to find a vector $c \subset \mathbb{R}^4$ that is as close to the vector $A \subset \mathbb{R}^4$ as possible while maintaining a constraint regarding ratios of elements of $c$, specifically $\frac{3}{4} \leq \frac{c[1]+c[2]}{c[3]+c[4]} \leq \frac{3}{2}$. I have no formal education on mathematical optimization but from what I do know a LP seemed like a good first stab.

With that in mind I came up with the following LP. It is not in standard form as that is much longer and the LP solvers that I was trying seemed to be ok with it as is.

$$min\ c^TA\ s.t.$$

$$2c[1]+2c[2]-3c[3]-3c[4] \leq 0$$

$$-4c[1]-4c[2]+3c[3]+3c[4] \leq 0$$

So this didn't work, and after some poking around it was brought to my attention that because $c$ is unbounded it can be brought to negative infinity.

My solution to this is to add a length constraint, which would turn this into a QCQP with a linear objective function and a quadratic constraint looking something like the following.

$$min\ c^TA\ s.t.$$

$$2c[1]+2c[2]-3c[3]-3c[4] \leq 0$$

$$-4c[1]-4c[2]+3c[3]+3c[4] \leq 0$$

$$||c||^2 = 1$$

My question is whether this is the correct direction to be heading, and if so is there any suggestions (and possibly sample code) for solvers that I can use. Any input would be greatly appreciated.

  • 0
    That is a QCLP, not a QCQP.2017-01-28

1 Answers 1

1

The way I read the problem you want $$\begin{align} \min \> & ||A-c||\\ & \frac{3}{4} (c_3+c_4) \le c_1+c2 \le \frac{3}{2}(c_3+c_4) \end{align}$$ With a QP solver you could use the objective: $$\min \> \sum_i (A_i-c_i)^2 $$ If you want to use an LP solver, you can use a norm that makes things easy, e.g.: $$ \min \sum_i |A_i-c_i|$$ One way to handle the absolute value is using a variable splitting technique: $$ \begin{align} \min \> & \sum_i (v_i^p + v_i^m)\\ & v_i^p - v_i^m = A_i-c_i\\ & v_i^p, v_i^m \ge 0 \end{align}$$

  • 0
    I hadn't considered that perspective to the problem. Thanks, this helps a lot! In your opinion is there a reason to use a QP solver if the problem can be formulated as a LP?2017-01-30
  • 0
    The objective is not exactly the same (we use a different norm). The quadratic obj will penalize large values more heavily.2017-01-31