0

I am working on solving optimization problems using integer linear programming, one of the constraints assume that the variable has a value belongs to a set of values like the following

 min 5*x1 + 2*x2
 s.t.
 x1,x2>0
 x1 in {2,4,-5}

how i can represent this problem to solve it using CPLEX or lp_solve in matlab? what are the values of F,A,b arrays?

Thanks

  • 1
    One thing you can try is writing `x1 = 2 * b1 + 4 * b2 -5 * b3` s.t. `0 <= b1, b2, b3 <= 1` and `b1, b2, b3 integer`. – Ben Voigt Apr 10 '14 at 19:23
  • @BenVoigt : That would work, but you would need to put an additional constraint of `(b1 + b2 + b3) <= 1`, otherwise `x1 = 6` may be a solution with `b1=1, b2=1, b3=0` – dhrumeel Apr 10 '14 at 19:31
  • @dhrumeel: Sorry, yes. I intended that `b1 + b2 + b3 = 1` and then forgot to type that into my question. (It needs to be equality, since `x1 = 0` is not allowed) – Ben Voigt Apr 10 '14 at 19:36
  • x1 = 0 is already avoided by the bounds `x1,x2>0` in the original problem. I guess that makes the (-5) term redundant as well. Also, many ILP solvers do not take equality constraints, so if we do want equality we would need to say `b1 + b2 + b3 <= 1` and `b1 + b2 + b3 >= 1` – dhrumeel Apr 10 '14 at 19:39
  • @dhrumeel: Yes, I included that well-known method of converting equality constraints, as well as a trick for making it compatible with interior-point methods. Whether strict inequality constraints are allowed depends on the solution method (e.g. barrier method solvers make all inequalities strict). Of course, one could instead use `-x1 <= -1` and still have `{2, 4}` feasible – Ben Voigt Apr 10 '14 at 19:43

1 Answers1

1

You can rewrite a problem where an integer variable takes on a finite discontiguous set of possible integral values as a binary program in more variables. Just write:

2 * b1 + 4 * b2 -5 * b3 - x1 = 0
b1 + b2 + b3 = 1

with b1, b2, b3 constrained as binary. That might be directly supported, or else expressed as

b1, b2, b3 integer
0 <= b1, b2, b3 <= 1

In case you aren't allowed equality constraints, remember that a pair of inequality constraints is equivalent.

 Ax = b;

is the same as

 Ax <= b
-Ax <- -b

But the solution set still has no interior, so interior point methods can't work. You can relax that by:

 Ax - e <= b
-Ax - e <= -b

and minimize e using your objective function.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720