0

Is it possible to solver QPs via precompiled binary files (interactive shell)?

I tried a couple of samples and none worked. Am I missing anything?

Minimize
obj: a + b + [ a^2 + 4 a * b + 7 b^2 ]
Subject To
c1: a + b >= 10
End

In this one I get the following msg:

[src/scip/reader_lp.c:147] ERROR: Syntax error in line 3 ('Subject'): expected '/2' or '/ 2' after end of quadratic part in objective. 
  input: Subject To
               ^
[src/scip/reader_lp.c:3362] ERROR: Error <-2> in function cal

Another example:

Maximize
 obj: x1 + 2 x2 + 3 x3 + x4
Subject To
 c1: - x1 * x3 + x2 + x3 + 10 x4 <= 20
 c2: x1 - 3 x2 + x3 <= 30
 c3: x2 - 3.5 x4 = 0
Bounds
 0 <= x1 <= 40
 2 <= x4 <= 3
General
 x4
End

and here is the output msg here:

[src/scip/reader_lp.c:147] ERROR: Syntax error in line 4 ('x3'): expected sign ('+' or '-') or sense ('<' or '>'). 
  input:  c1: - x1  x3 + x2 + x3 + 10 x4 <= 20
                       ^
[src/scip/reader_lp.c:3362] ERROR: Error <-2> in function call
error reading file <sample.lp>
Daniel
  • 5,839
  • 9
  • 46
  • 85

2 Answers2

1

Maybe try the .pip format (http://polip.zib.de/pipformat.php). That is similar to .lp, but less awkward when it comes to specifying quadratics.

stefan
  • 799
  • 4
  • 9
1

The fixed first example would be

Minimize
obj: a + b + [ 2 a^2 + 8 a * b + 14 b^2 ] / 2
Subject To
c1: a + b >= 10
End

The fixed second example would be

Maximize
obj: x1 + 2 x2 + 3 x3 + x4
Subject To
c1: x2 + x3 + 10 x4 + [ - x1 * x3 ] + <= 20
c2: x1 - 3 x2 + x3 <= 30
c3: x2 - 3.5 x4 = 0
Bounds
0 <= x1 <= 40
2 <= x4 <= 3
General
x4
End

Check also the CPLEX manual on the specification of the .lp file format.

stefan
  • 799
  • 4
  • 9