-1

I have following problem that I try to solve with LPSolve IDE:

min: x1;
r_1: 1.08 - k <= x1;
r_2: -1.08 + k <= x1;
c_1: y1 + y2 + y3 = k;
c_2: 2.29 a1 y1 + 2.28 a2 y1 + 2.27 a3 y1 = 1;
c_3: 1.88 b1 y2 + 1.89 b2 y2 + 1.9 b3 y2 = 1;
c_4: 8.98 c1 y3 + 8.99 c2 y3 + 9.0 c3 y3 = 1;

c_14: a1+a2+a3=1;
c_15: b1+b2+b3=1;
c_16: c1+c2+c3=1;


bin a1,a2,a3,b1,b2,b3,c1,c2,c3;

Not sure why I get output from LPSolve as INFEASIBLE when I can use following param values to solve this:

a1=0, a2=1, a3=0
b1=0, b2=1, b3=0
c1=0, c2=1, c3=0

0 + 2.28 0.438596491 + 0 = 1
0 + 1.89 0.529100529 + 0 = 1
0 + 8.99 0.111234705 + 0 = 1

0.438596491 + 0.529100529 + 0.111234705 = 1.0789 (this is k)

1.08 - 1.0789 == 0.0011 <= x1
-1.08 + 1.0789 == -0.0011 <= x1

x1 = 0.0011

Am I formulating the problem in a wrong way, or doing something else wrong? If I relax that =1 constraint to >=1 there are some results, but I need it to be 1 (as it is in my solution).

Bojan Vukasovic
  • 2,054
  • 22
  • 43

1 Answers1

1

Lpsolve is for linear models only. You have products of variables in the model such as 2.29 a1 y1. Lpsolve can not solve such quadratic models.

Too bad you don't get a good error message. I guess they never expected this input.

It is noted that products of binary and continuous variables can be linearized resulting in so-called big-M constraints (see link).

This is really a duplicate of lpsolve - unfeasible solution, but I have example of 1. Embarrassingly, this was an earlier question from the same poster!

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • thanks for answer. do you know why it works if I use constraints <= 1 istead of =1? – Bojan Vukasovic Aug 05 '19 at 11:49
  • Your input is bogus. The lp file reader is interpreting `2.29 a1 y1` as `2.29 a1 + y1`. So you are solving a very different model than you think you are. You think you are solving a nonlinear model, while the lp reader interprets the input as a very different linear model. Remember: multiplication of variables is not allowed in LPSolve. Just never, never, never, never, ever write something like `2.29 a1 y1`. I think this is an example of **garbage in, garbage out**. – Erwin Kalvelagen Aug 05 '19 at 17:59