0

I want to write a constraint with ORs in a MILP. In particular, the following:

$$x \ge c \lor x \le -c \lor x=0,$$

where $c$ is just a real number.

Can anyone give me some hints?

ali_ka
  • 1
  • 1
  • https://blog.adamfurmanek.pl/2015/08/22/ilp-part-1/ and https://blog.adamfurmanek.pl/2015/09/12/ilp-part-4/ and https://blog.adamfurmanek.pl/2015/11/21/ilp-part-14/ (and optionally https://blog.adamfurmanek.pl/2015/09/19/ilp-part-5/ ) – user1543037 Apr 29 '20 at 15:51
  • https://cs.stackexchange.com/q/12102/755 – D.W. Apr 30 '20 at 04:36

1 Answers1

-1

Tough. You are leaving linear programming.

Solve the problem without these equations and with no restriction for the sign of x. If by coincidence x matches one of the conditions, you are done. Otherwise you will need to solve the problem with one of these equations added.

Calculate how much changing x by eps changes the optimal solution. With that guess how much adding x=0, x>=c, or x<=-c would affect the optimal solution. Add the equation that seems to cause the least damage and solve with an optimal goal function G. Then try adding each of the other equations, with an additional restriction goal >= G.

You could have just tried adding each equation in turn and solving, but this way you might find quicker that one condition can’t lead to an optimal solution. For example if c=100 and your optimal solution was x=80, you can add x>=100, optimise , and you can likely show easy that x=0 or x<= -100 will lead to a worse outcome.

gnasher729
  • 29,996
  • 34
  • 54
  • I don't see how this is correct, and I don't see the point in doing this since logical ors can clearly be formulated in MILP. – Laakeri Apr 30 '20 at 05:56
  • @Laakeri, makes sense... but to be fair, the question body & title are inconsistent about whether the question is asking about MILP or LP. – D.W. Apr 30 '20 at 07:50
  • @Laakeri So what’s incorrect? Basic method for integer programming, with lots of other applications. – gnasher729 Apr 30 '20 at 13:02
  • 1
    I see now, this is the branch and bound method for integer programming. Maybe not worth a downvote, but I still think that the answer is probably not useful for the asker since writing an ILP solver by yourself is not realistic compared to writing an ILP encoding of a constraint. – Laakeri May 01 '20 at 05:40