# TOMLAB  
# REGISTER (TOMLAB)
# LOGIN  
# myTOMLAB
TOMLAB LOGO

« Previous « Start » Next »

C  The Matlab Interface Routines - Test Routines

C.1  xpaircrew

Purpose
Test of an air-crew schedule generation problem.

Calling Syntax
xpaircrew

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables. Set before the callback.
xpProblemAttrib Structure with all XpressMP problem attributes. Set before the callback.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

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 xpaircrew.m file): The function generateToDs create ToDs, i.e. Tours of Duty. The function sectordata generates some test data.

M-files Used
abc2gap, xpress

C.2  xpbiptest

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

Calling Syntax
function xpbiptest(Cut, PreSolve, MipPre, NodeSel, BackTrack, xpcontrol)

Description of Input

Cut
Value of the CUTSTRATEGY control parameter, default Cut = −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.
MipPre Value of the MIPPRESOLVE control parameter, where the default value is dependent on the matrix characteristics. It determines the type of integer processing to be performed in the Branch and Bound. MipPre = 0, no processing will be performed. If bit 0 is set, do reduced cost fixing at each node. If bit 1 is set, do logical preprocessing on binary variables at each node. If bit 2 is set, do probing of binary variables is performed at the top node. A value MipPre = 7 will set all three bits as 1.
NodeSel Value of the NODESELECT control parameter. The default value is dependent on the matrix characteristics. It determines which nodes will be considered for solution once the current node has been solved. NodeSel = 1, choose among the two descendant nodes, if none among all active nodes. NodeSel = 2, all nodes are always considered. NodeSel = 3, depth-first search exploring both descendants first. NodeSel = 4, all nodes are considered for the first BREADTHFIRST nodes, after which the usual default behavior is resumed. Setting xpcontrol.BREADTHFIRST influences the last choice.

Description of Input

BackTrack
Value of the BACKTRACK control parameter, default value is 3. Determines how the next node in the tree search is selected for processing. BackTrack = 1, if MIPTARGET is not set, choose the node with the best estimate. Otherwise the node choice is based on the Forrest-Hirst-Tomlin Criterion, which takes into account the best current integer solution and seeks a new node which represents a large potential improvement. BackTrack = 2, always choose the node with the best estimated solution. BackTrack = 3, always choose the node with the best bound on the solution.
xpcontrol The initial xpcontrol structure. Here the user may set additional control parameters, e.g. xpcontrol.BREADTHFIRST. Default empty.

Global Parameters Used
   
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Test of three larger binary integer linear optimization problems calling the XpressMP 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. XpressMP 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 xpbiptest(0,0) gives the fastest execution for the first two problems, but will be extremly slow for the third problem.

It might be interesting the follow the progress towards the solution by setting the global log callback. This could be done by removing the comment from the line
% callback(9) = 1;
in the code.

Timings are made with the Matlab functions tic and toc.

M-files Used
xpress, xpprint

C.3  xpiptest

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

Calling Syntax
function xpiptest(Cut, PreSolve, MipPre, NodeSel, BackTrack, xpcontrol)

Description of Input

Cut
Value of the CUTSTRATEGY control parameter, default Cut = −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.

Description of Input

MipPre
Value of the MIPPRESOLVE control parameter, where the default value is dependent on the matrix characteristics. It determines the type of integer processing to be performed in the Branch and Bound. MipPre = 0, no processing will be performed. If bit 0 is set, do reduced cost fixing at each node. If bit 1 is set, do logical preprocessing on binary variables at each node. If bit 2 is set, do probing of binary variables is performed at the top node. A value MipPre = 7 will set all three bits as 1.
NodeSel Value of the NODESELECT control parameter. The default value is dependent on the matrix characteristics. It determines which nodes will be considered for solution once the current node has been solved. NodeSel = 1, choose among the two descendant nodes, if none among all active nodes. NodeSel = 2, all nodes are always considered. NodeSel = 3, depth-first search exploring both descendants first. NodeSel = 4, all nodes are considered for the first BREADTHFIRST nodes, after which the usual default behavior is resumed. Setting xpcontrol.BREADTHFIRST influences the last choice.

Description of Input

BackTrack
Value of the BACKTRACK control parameter, default value is 3. Determines how the next node in the tree search is selected for processing. BackTrack = 1, if MIPTARGET is not set, choose the node with the best estimate. Otherwise the node choice is based on the Forrest-Hirst-Tomlin Criterion, which takes into account the best current integer solution and seeks a new node which represents a large potential improvement. BackTrack = 2, always choose the node with the best estimated solution. BackTrack = 3, always choose the node with the best bound on the solution.
xpcontrol The initial xpcontrol structure. Here the user may set additional control parameters, e.g. xpcontrol.BREADTHFIRST. Default empty.

Global Parameters Used
   
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Test of three larger integer linear optimization problems calling the XpressMP 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 XpressMP presolve will do all these problem changes.

It might be interesting the follow the progress towards the solution by setting the global log callback. This could be done by removing the comment from the line
% callback(9) = 1;
in the code.

A call xpiptest(2,1,3,3,3) probably gives the fastest execution. Timings are made with the Matlab functions tic and toc.

M-files Used
xpress, xpprint

C.4  xptomtest1

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

Calling Syntax
xptomtest1

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

M-files Used
tomRun.

See Also
xpressTL.

C.5  xptomtest2

Purpose
Test of using TOMLAB to call XpressMP for problems defined in the TOMLAB TQ format.

Calling Syntax
xptomtest2

Description
Test of using TOMLAB to call XpressMP for problems defined in the TOMLAB TQ format. The routine mipAssign is used to define the problem. A simple problem is solved with XpressMP both as an LP problem and as a MILP problem. The problem is solved both with and without explicitly defining the slack variables.

M-files Used
mipAssign, tomRun and PrintResult.

See Also
xpressTL and xpress.

C.6  xpknaps

Purpose
XpressMP Matlab level 1 interface Knapsack test routine

Calling Syntax
xpknaps(P, Run, Cut)

Description of Input

P
Problem number 1-3. Default 1.
Run If empty or Run ≤ 0, run normal XpressMP global solve. If Run >0 run simple knapsack heuristic in callback xpcb_GL.m Default 0.
Cut Cut strategy. 0 = no cuts, 1 = cuts, 2 = aggressive cuts. Default 0.

Global Parameters Used
   
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.

Description
The XpressMP 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
xpress

C.7  xpknapsTL

Purpose
XpressMP Matlab level 1 interface Knapsack test routine

Calling Syntax
xpknapsTL(P, Run, Cut)

Description of Input

P
Problem number 1-3. Default 1.
Run If empty or Run ≤ 0, run normal XpressMP global solve. If Run >0 run simple knapsack heuristic in callback xpcb_GL.m Default 0.
Cut Cut strategy. 0 = no cuts, 1 = cuts, 2 = aggressive cuts. Default 0.

Global Parameters Used
   
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.

Description
The XpressMP Matlab level 2 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
xpress

C.8  xptest1

Purpose
Test routine 1, calls XpressMP Matlab level 1 interface to solve a GAP problem.

Calling Syntax
x = xptest1

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Running a generalized assignment problem (GAP) from Wolsey [2, 9.8.16, pp165]. In this test the linear sos1 constraints are defined explicitly.

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

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

M-files Used
abc2gap, xpress

C.9  xptest2

Purpose
Test routine 2, calls XpressMP Matlab level 1 interface to solve a GAP problem.

Calling Syntax
x = xptest2

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Running a generalized assignment problem (GAP) from Wolsey [2, 9.8.16, pp165]. In this test sos1 variables are used.

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

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

M-files Used
abc2gap, xpress

See Also
xptest3

C.10  xptest3

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

Calling Syntax
x = xptest3

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

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

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

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

M-files Used
abc2gap, xpress

See Also
xptest2

C.11  xptestqp1

Purpose
Simple test of calling XpressMP Matlab level 1 interface to solve a QP problem.

Calling Syntax
x = xptestqp1(MIP)

Description of Input

MIP
If MIP = 1, run as a MIQP problem, trying to make the first variable integer valued, otherwise run as a pure QP problem. Default MIP = 0.

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Simple test of calling XpressMP Matlab level 1 interface to solve a QP or MIQP problem. The problem is the first test problem in the TOMLAB qpprob.m file.

M-files Used
xpress

C.12  xptestqp2

Purpose
Simple test of MIQP problem running XpressMP . Simple test of calling XpressMP Matlab level 1 interface to solve a QP problem.

Calling Syntax
x = xptestqp2(MIP)

Description of Input

MIP
If MIP = 1 (default), run as a MIQP problem, trying to make the first variable integer valued, otherwise run as a pure QP problem.

Global Parameters Used
   
xpControlVariables Structure with all XpressMP control variables.
xpProblemAttrib Structure with all XpressMP problem attributes.
MAX_x Maximal number of x elements printed in output statements. Default 20.
MAX_c Maximal number of constraint elements printed in output statements. Default 20.

Description
Simple test of MIQP problem running XpressMP . The MIQP problem is from the Xpress-Optimizer Reference Manual [1], page 166. The problem is defined as

 
min
x
f(x) = −6x1 + 2x12 − 2x1x2 + 2x22    
s/t 0 x1,x2
      x1 + x2 1.9
      x1 integer.    


M-files Used
xpress

« Previous « Start » Next »