GUROBI Appendix B

From TomWiki
Jump to navigationJump to search

Notice.png

This page is part of the GUROBI Manual. See GUROBI.

The Matlab Interface Routines - Test Routines

grbaircrew

Purpose

Test of an air-crew schedule generation problem.

Calling Syntax

grbaircrew

Description

Test of an air-crew schedule generation problem. Based on D.M.Ryan, Airline Industry, Encyclopedia of Operations Research and Management Science. Two subfunctions are used (defined at the end of the grbaircrew.m file): The function generateT oDs create ToDs, i.e. Tours of Duty. The function sectordata generates some test data.

M-files Used

abc2gap.m, gurobi.m

grbbiptest

Purpose

Test of TOMLAB /GUROBI level 1 interface solving three larger binary integer linear optimization problems calling the GUROBI solver.

Calling Syntax

function grbbiptest(Cut, PreSolve, grbControl)

Description of Input

Input Description
Cut Value of the cut strategy control parameter, default C ut = -1.

Cut = -1, auto select of Cut = 1 or Cut = 2.

Cut = 0, no cuts.

Cut = 1, conservative cut strategy.

Cut = 2, aggressive cut strategy

PreSolve Value of the PRESOLVE control parameter, default PreSolve = 1.

PreSolve = 0: no presolve.

PreSolve = 1, do presolve.

grbControl The initial GUROBI parameter structure. Here the user may set additional control parameters. Default empty.

Description

Test of three larger binary integer linear optimization problems calling the GUROBI solver. The test problem 1 and 2 have 1956 variables, 23 equalities and four inequalities with both lower and upper bounds set.

Test problem 1, in bilp1.mat, is randomly generated. It has several minima with optimal zero value. GUROBI runs faster if avoiding the use of a cut strategy, and skipping presolve. Test problem 2, in bilp2.mat, has a unique minimum. Runs faster if avoiding the use of presolve.

Test problem 3, in bilp1211.mat, has 1656 variables, 23 equalities and four inequalities with lower and upper bounds set. Runs very slow without the use of cuts. A call grbbiptest(0, 0) gives the fastest execution for the first two problems, but will be extremely slow for the third problem.

Timings are made with the Matlab functions tic and toc.

M-files Used

gurobi.m, grbPrint.m

grbiptest

Purpose

Test of the TOMLAB /GUROBI level 1 interface solving three larger integer linear optimization problems calling the GUROBI solver.

Calling Syntax

function grbiptest(Cut, PreSolve, grbControl)

Description of Input

Input Description
Cut Value of the cut strategy parameters, default Cut = -1.

Cut = -1, auto select of C ut = 1 or Cut = 2.

Cut = 0, no cuts. Cut = 1, conservative cut strategy.

Cut = 2, aggressive cut strategy

See grbbiptest, page 22.

PreSolve Value of the PRESOLVE control parameter, default PreSolve = 1.

PreSolve = 0, no presolve.

PreSolve = 1, do presolve.

grbControl The initial grbControl structure. Here the user may set additional control parameter. Default empty.

Description

Test of three larger integer linear optimization problems calling the GUROBI solver. The test problems have 61 variables and 138 linear inequalities. 32 of the 138 inequalities are just zero rows in the matrix A. The three problems are stored in ilp061.mat, ilp062.mat and ilp063.mat.

Code is included to remove the 32 zero rows, and compute better upper bounds using the positivity of the matrix elements, right hand side and the variables. But this does not influence the timing much, the GUROBI presolve will do all these problem changes.

Timings are made with the Matlab functions tic and toc.

M-files Used

gurobi, xprinti, grbPrint

grbtomtest1

Purpose

Test of using TOMLAB to call GUROBI for problems defined in the TOMLAB IF format.

Calling Syntax

grbtomtest1

Description

Test of using TOMLAB to call GUROBI for problems defined in the TOMLAB IF format. The examples show the solution of LP and MILP problems.

M-files Used

tomRun.

See Also

gurobiTL.

grbtomtest2

Purpose

Test of using TOMLAB to call GUROBI for problems defined in the TOMLAB format.

Calling Syntax

grbtomtest2

Description

Test of using TOMLAB to call GUROBI for problems defined in the TOMLAB format. The routine mipAssign is used to define the problem. A simple problem is solved with GUROBI both as an LP problem and as a MILP problem.

M-files Used

mipAssign, tomRun and PrintResult.

See Also

gurobiTL and gurobi.

grbKnaps

Purpose

GUROBI Matlab Level 1 interface Knapsack test routine

Calling Syntax

grbKnaps(P, Cut)

Description of Input

Input Description
P Problem number 1-3. Default 1.
Cut Cut strategy. 0 = no cuts, 1 = cuts, 2 = aggressive cuts. Default 0.

Description

The GUROBI Matlab level 1 interface knapsack test routine runs three different test problems. It is possible to change cut strategy and use heuristics defined in callbacks.

Currently defined knapsack problems:

Problem Name Knapsacks Variables
1 Weingartner 1 2 28
2 Hansen, Plateau 1 4 28
3 PB 4 2 29

M-files Used

gurobi.m

grbKnapsTL

Purpose

GUROBI Matlab Level 2 interface Knapsack test routine

Calling Syntax

grbKnapsTL(P, Cut)

Description of Input

Input Description
P Problem number 1-3. Default 1.
Cut Cut strategy. 0 = no cuts, 1 = cuts, 2 = aggressive cuts. Default 0.

Description

The GUROBI Matlab level 2 interface knapsack test routine runs three different test problems. It is possible to change cut strategy.

Currently defined knapsack problems:

Problem Name Knapsacks Variables
1 Weingartner 1 2 28
2 Hansen, Plateau 1 4 28
3 PB 4 2 29

M-files Used

gurobi.m

grbTest1

Calling Syntax

x = grbTest1

Description

Running a generalized assignment problem (GAP) from Wolsey. In this test the linear sos1 constraints are defined explicitly.

Given the matrices A (constraints) and C (costs), grbTest1 is using the utility abc2gap to reformulate the problem into the standard form suitable for GUROBI.

The number of iterations are increased, no presolve is used, and an aggressive cut strategy.

M-files Used

abc2gap.m,gurobi.m

grbTest2

Calling Syntax

x = grbTest2

Description

Running a generalized assignment problem (GAP) from Wolsey. In this test sos1 variables are used.

Given the matrices A (constraints) and C (costs), grbTest2 is using the utility abc2gap to reformulate the problem into the standard form suitable for GUROBI.

The number of iterations are increased, no presolve is used, and an aggressive cut strategy is applied.

M-files Used

abc2gap.m, gurobi.m

See Also

grbTest3.m

grbTest3

Purpose

Test routine 3, calls GUROBI Matlab level 1 interface to solve a GAP problem.

Calling Syntax

x = grbTest3

Description

Running a generalized assignment problem (GAP) from Wolsey [?, 9.6, pp159]. In this test the linear sos1 constraints are defined explicitly.

Given the matrices A (constraints) and C (costs), grbTest1 is using the utility abc2gap to reformulate the problem into the standard form suitable for GUROBI.

The number of iterations are increased, no presolve is used, and no cut strategy is used.

M-files Used

abc2gap.m, gurobi.m

See Also

grbTest2

grbTestIIS

Purpose

Demonstration of the TOMLAB /GUROBI IIS feature.

Calling Syntax

x = grbTestIIS()

Description

Modify bounds to produce an infeasibility and invoke GUROBI again with IIS enabled.

grbTestSA

Purpose

Demonstration of the GUROBI SA feature.

Calling Syntax

x = grbTestSA()

Description

Run sensitivity analysis for a set of variables in the objective and in the constraints.