maximizing absolute value in linear programming

176 Views Asked by At

I know that this question has been answered several times, and based on the answers, I attempted something. But I simply do not get the right results. The question is as follows. I wish to solve the following optimization problem:

$max(ax_1)$ subject to $x_1 = |x_2-x_3|$

$a$ can be both positive and negative.

I tried to set up the a "Big-M" method based Binary LP (The bounds are well known and reasonably small.) by using the following constraints:

$x_1+(x_2-x_3)\leq M*p$

$x_1-(x_2-x_3)\leq M*(1-p)$

$x_1+(x_2-x_3)\geq -M*p$

$x_1-(x_2-x_3)\geq -M*(1-p)$

where p is binary.

The bounds are $0 \leq x_1 \leq U$, where $U << M$; $-\infty \leq x_2 \leq \infty $; $-\infty \leq x_3 \leq \infty$

But this did not work. Is my above approach correct? What am I doing wrong? What are the alternatives? This is the theoretical part.

In practice, I am having an issue with the following problem. $max(x_1(1)+x_1(2)+x_1(3))$

such that

$x_1(1) = |x_2(2)-x_2(1))|$

$x_1(2) = |x_2(3)-x_2(2))|$

$x_1(3) = |x_2(4)-x_2(3))|$

the bounds are $0\leq x_1(1) \leq 4$, $0 \leq x_1(2) \leq 12$, $0\leq x_1(3) \leq 11$. for $x_2(1,...,4)$, the bounds are [-inf inf].

I expect the fval to be 27 so that I get $x_1(1,...,3) = [4, 12, 11]$. But I get fval to be 4 and $x_1 = [4, 0, 0]$. Also, $x_2 = [4, 0, 0, 0]$, and $p = [0, 0, 0]$. The solver (cplex) status is

cplexstatus: 101

cplexstatusstring: 'integer optimal solution'

iterations: 1

algorithm: 12

time: 0.0019

message: 'Function converged to a solution x.'

I also tried to force $[x_1 = 4, 12, 11]$ but that led to status 'integer infeasible' with the message 'No feasible point was found.'

I suppose I am making a big blooper somewhere, but I cant figure out where...!