scip optimization suite. three main software –zimpl: compiler of zimpl modeling language...

26
SCIP Optimization Suite

Upload: kiara-ibbotson

Post on 14-Dec-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

SCIP Optimization Suite

Page 2: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

2

SCIP Optimization Suite

• Three main software – zimpl: Compiler of ZIMPL modeling language

– soplex: LP solver (implementation of Simplex)

– scip: An advanced implementation of B&B to solve ILP

• All these are available in single packages– SCIP optimization suite

– Source code

– zimpl, soplex, scip are standalone applications

– Binary (Linux & Windows)

– Single executable scip application that is linked by zimpl & soplex

Page 3: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

3

How Does It Work?• As a programming library

– It has API, you can call the functions in C, C++

• As a standalone solver– Develop a model in zimpl language – Compile/Translate your model: zimpl model.zpl– Solve it

• LP problems: soplex model.lp• ILP, MIP problems: scip -f model.lp

– scip by itself calls zimpl if the input file is not .lp• scip -f model.zpl

Page 4: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

4

max( )

mins.t.

~

i ii

ij i ji

f x cx

a x b j

=

"

å

å

Page 5: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

5

What we need

• Parameters • Variables

• Sets

• Objective function

• Constraints

, ,i ij jc a b

ix

,i I j JÎ Î

( )f x

~ij i ji

a x bå

Page 6: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

6

Sets

• Set of numbers

• Set of strings

• Set of tuples

Page 7: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

7

Set operations

Page 8: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

8

{<1, “hi”>, <2, “hi”>, <3, “hi”>, <1, “ha”>, …}

{1, 6, 7, 8, 9}

Page 9: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

9

Indexed Sets

• The arrays of ZIMPL

• Each element has its own index– A set indexes another set

• Refer to i-th element by S[i]

• Exampleset I := {1, 2, 4};

set A[I] := <1> {10}, <2> {20}, <4> {30,40,50};

set B[ <i> in I] := {10 * i};

Page 10: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

10

Parameters

• set A := {1,2,3};

• param B := 10;

• param C[A] := <1> 10, <2> 20, <3> 30;

• param D[A] := <1> 100 default 0;

• param E := min A;

• param F := max <i> in A : C[i];

Page 11: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

11

These operations are used in zimpl models to generate the numerical model.

Most operations are applicable only on parameters, cannot be used for variables, because they are not linear

Page 12: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

12

Variables

• “real”, “binary”, or “integer”– Default is “real”

• var x1;

• var x2 integer;

• var x3 binary;

• set A := {1,2,3};

• var x4[A] real;

• var x5[A * A] integer >=0 <= 10;

Page 13: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

13

Objective

• “maximize” or “minimize”

• var x1;

• var x2;

• var x3;

• maximize obj1: x1 + x2 + x3;

• minimize obj2: 2*x1 + 3*x2;

Page 14: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

14

Objective

• set A := {1,2,3};

• param B[A] := <1> 10, <2> 20, <3> 30;

• var X[A];

• maximize obj1: sum <i> in A: X[i];

• minimize obj2: sum <i> in A: B[i] * X[i];

Page 15: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

15

Constraint

• subto name: constraint– “<=“ , “=>”, “==“ – There is not “>” and “<“

• subto c1: x1 <= 10;

• subto c2: x1 + x2 <= 20;

• subto c3: x1 + x2 + x3 == 100;

Page 16: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

16

Constraint

• set A := {1,2,3};

• param B[A] := <1> 10, <2> 20, <3> 30;

• var X[A];

• subto c1: forall <i> in A: X[i] <= B[i];

Page 17: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

17

Expressions

• forall expression– forall <i> in S: x[i] <= b[i];

• sum expression– sum <i> in S: x[i];

• if expression– forall <i> in S: x[i] <= if (i mod 3 == 0) then A[i]

else B[i] end;

Page 18: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

18

Example

max

s.t.

[1,20,300]

1 2 3 20,

30 20 10 200

Tc x

Ax b

c

A b

£

=

é ù é ùê ú ê ú= =ê ú ê úê ú ê úë û ë û

Page 19: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

19

set I := {1,2,3};set J := {1,2};

param c[I] := <1> 1, <2> 20, <3> 300;param A[J * I] := <1,1> 1, <1,2> 2, <1,3> 3, <2,1>

30, <2,2> 20, <2,3> 10;param b[J] := <1> 20, <2> 200;

var X[I];

maximize obj: sum <i> in I: c[i] * X[i];

subto const: forall <j> in J:sum <i> in I: A[j,i] * X[i] <= b[j];

Page 20: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

20

Realistic Problems

• A model for the problem

• Multiple instances– Each instance has its own data

• Separation between model and data– Create a general model

– Read data from file

Page 21: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

21

Reading Set and Parameters from file

• “read filename as template”

• set A := {read "a.txt" as "<1n>"};

• a.txt12345

Page 22: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

22

• set A := {read "a.txt" as "<1n>"};

• param B[A] := read "b.txt" as "<1n> 2s";

• a.txt b.txt

1 1 aa

2 3 bb

3 2 cc

Page 23: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

23

max

s.t.

Tc x

Ax b£

Page 24: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

24

set I := {read "I.txt" as "<1n>"};set J := {read "J.txt" as "<1n>"};

param c[I] := read "c.txt" as "<1n> 2n";param A[J * I] := read "A.txt" as "<1n,2n> 3n";param b[J] := read "b.txt" as "<1n> 2n";

var X[I];

maximize obj: sum <i> in I: c[i] * X[i];

subto const: forall <j> in J:sum <i> in I: A[j,i] * X[i] <= b[j];

Page 25: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

25

Page 26: SCIP Optimization Suite. Three main software –zimpl: Compiler of ZIMPL modeling language –soplex: LP solver (implementation of Simplex) –scip: An advanced

26

Integrality Complexity: An Example

• Consider the LP problem– I = 1000 – J = 100

• If variables are “real”– Solution time = 0.21 sec.– Objective = 1727.05

• If variables are “integer”– Solution time = 22.85 sec.– Objective = 1724