0
votes

I try to use the GurobiTM Optimizer. Please find below my QP model :

The problems most commonly solved by the Gurobi Parallel Mixed Integer Programming solver are of the form: Objective: minimize cT x Constraints: A x = b (linear constraints) l ≤ x ≤ u (bound constraints) some or all xj must take integer values (integrality constraints)

Maximize
  - x1 + .5 x2 + .5 x3 + x4 - x5 + .5 x6 + .5 x7 - x8
  - .17 x1 * x2 + .66 * x1 * x3  + .66  x1 * x4
  + .56 x2 * x3 + .49 x2 * x4
  - .17 x5 * x6 + .82 x5 * x7 + .66 x5 * x8
  + .16  x6 * x7 + .49 x6 * x8
Subject To
  c1: x1 + x5 <=1
  c2: x2 + x6 <=1,
  c3: x3 + x7 <=1
  c4: x4 + x8 <=1,
  c5: x1 + x2 + x3 + x4 <= 2
  c6: x5 + x6 + x7 + x8 <= 2
Bounds
 0 <= x1 <= 1
 0 <= x2 <= 1
 0 <= x3 <= 1
 0 <= x4 <= 1
 0 <= x5 <= 1
 0 <= x6 <= 1
 0 <= x7 <= 1
 0 <= x8 <= 1
Integers
  PS PD JS JD AS AD MS MD
End


It seems that according to Gurobi Interactive Shell the syntax is not correct :

Error reading LP format file /.../toyproblem.lp at line 2
Malformed term in expression
Neighboring tokens: " - .17 x1 * x2 + .66 * x1 * "

Any idea ?

Thanks in advance for your help,

MM.

2

2 Answers

0
votes

That's not a linear program (LP) - it's a quadratic program (QP) that isn't written in standard form. Additionally, it's very bad form to write a product of binary variables; you should introduce new binary variables to represent the logical condition. For example, replace w1 * w2 by a new variable z with constraints z <= w1, z <= w2, z >= w1 + w2 - 1.

0
votes

The error was on the third line: - .17 x1 * x2 + .66 * x1 * x3 + .66 x1 * x4 it should be: - .17 x1 * x2 + .66 x1 * x3 + .66 x1 * x4 instead

For the record. Gurobi does handle QP and it calls it simplex... although we know it's not really simplex in the real sense. They used something called "active-set methods"

you may want to post questions in their google group. They answer within a day over there :)