« Previous « Start » Next »
C The Matlab Interface Routines - Test Routines
C.1 cpxaircrew
Purpose
Test of an air-crew schedule generation problem.
Calling Syntax
cpxaircrew
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 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
cpxaircrew.m file): The function
generateToDs create ToDs,
i.e. Tours of Duty. The function
sectordata generates some test
data.
M-files Used
abc2gap.m,
cplex.m
C.2 cpxbiptest
Purpose
Test of TOMLAB /CPLEX level 1 interface solving three larger binary integer
linear optimization problems calling the CPLEX solver.
Calling Syntax
function cpxbiptest(Cut, PreSolve, cpxControl)
Description of Input
Cut |
Value of the cut strategy 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 |
|
The cut strategy choice is implemented by setting the following parameters
(omitting prefix “CPX_PARAM_)”: |
|
CLIQUES, COVERS, DISCJUTS, FLOWCOVERS, FLOWPATHS,
FRACCUTS, GUBCOVERS, IMPLED, MIRCUTS in the cpxControl structure. |
|
PreSolve |
Value of the PRESOLVE control parameter, default PreSolve = 1. |
|
PreSolve = 0: no presolve. |
|
PreSolve = 1, do presolve. |
|
cpxControl |
The initial CPLEXparameter structure. Here the user may set
additional control parameters. 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 CPLEX 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.
CPLEX 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
cpxbiptest(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
cplex.m,
cpxPrint.m
C.3 cpxiptest
Purpose
Test of the TOMLAB /CPLEX level 1 interface solving three larger integer
linear optimization problems calling the CPLEX solver.
Calling Syntax
function cpxiptest(Cut, PreSolve, cpxControl)
Description of Input
Cut |
Value of the cut strategy parameters, 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 |
|
See cpxbiptest, page ??. |
|
PreSolve |
Value of the PRESOLVE control parameter, default PreSolve = 1. |
|
PreSolve = 0, no presolve. |
|
PreSolve = 1, do presolve. |
|
cpxControl |
The initial cpxControl structure. Here the user may set
additional control parameter. 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 CPLEX 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 CPLEX
presolve will do all these problem changes.
Timings are made with the Matlab functions
tic and
toc.
M-files Used
cplex,
xprinti,
cpxPrint
C.4 cpxtomtest1
Purpose
Test of using TOMLAB to call CPLEX for problems defined in the TOMLAB
IF format.
Calling Syntax
cpxtomtest1
Description
Test of using TOMLAB to call CPLEX 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
cplexTL.
C.5 cpxtomtest2
Purpose
Test of using TOMLAB to call CPLEX for problems defined in the TOMLAB
TQ format.
Calling Syntax
cpxtomtest2
Description
Test of using TOMLAB to call CPLEX for problems defined in the TOMLAB
TQ format. The routine
mipAssign is used to define the problem. A
simple problem is solved with CPLEX 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
cplexTL and
cplex.
C.6 cpxKnaps
Purpose
CPLEX Matlab Level 1 interface Knapsack test routine
Calling Syntax
cpxKnaps(P, Cut)
Description of Input
P |
Problem number 1-3. Default 1. |
|
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. |
Description
The CPLEX 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
cplex.m
C.7 cpxKnapsTL
Purpose
CPLEX Matlab Level 2 interface Knapsack test routine
Calling Syntax
cpxKnapsTL(P, Cut)
Description of Input
P |
Problem number 1-3.
Default 1. |
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. |
Description
The CPLEX 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
cplex.m
C.8 cpxTest1
Purpose
Test routine 1, calls
CPLEX Matlab level 1 interface to solve a GAP problem.
Calling Syntax
x = cpxTest1
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
Running a generalized assignment problem (GAP) from Wolsey
[
1, 9.8.16, pp165].
In this test the
linear sos1 constraints are defined explicitly.
Given the matrices
A (constraints) and
C (costs),
cxpTest1 is using the utility
abc2gap to reformulate
the problem into the standard form suitable for CPLEX.
The number of iterations are increased, no presolve is used,
and an aggressive cut strategy.
M-files Used
abc2gap.m,
cplex.m
C.9 cpxTest2
Purpose
Test routine 2, calls
CPLEX Matlab level 1 interface to solve a GAP problem.
Calling Syntax
x = cpxTest2
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
Running a generalized assignment problem (GAP) from Wolsey
[
1, 9.8.16, pp165].
In this test sos1 variables are used.
Given the matrices
A (constraints) and
C (costs),
cpxTest2 is using the utility
abc2gap to reformulate
the problem into the standard form suitable for CPLEX.
The number of iterations are increased, no presolve is used,
and an aggressive cut strategy is applied.
M-files Used
abc2gap.m,
cplex.m
See Also
cpxTest3.m
C.10 cpxTest3
Purpose
Test routine 3, calls
CPLEX Matlab level 1 interface to solve a GAP problem.
Calling Syntax
x = cpxTest3
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
Running a generalized assignment problem (GAP) from Wolsey
[
1, 9.6, pp159].
In this test the
linear sos1 constraints are defined explicitly.
Given the matrices
A (constraints) and
C (costs),
cpxTest1 is using the utility
abc2gap to reformulate
the problem into the standard form suitable for CPLEX.
The number of iterations are increased, no presolve is used,
and no cut strategy is used.
M-files Used
abc2gap.m,
cplex.m
See Also
cpxTest2
C.11 cpxTestQP1
Purpose
Simple test of calling CPLEX Matlab level 1 interface to solve a QP problem.
Calling Syntax
x = cpxTestQP1(MIP,DEFPARAM)
Description of Input
MIP |
If MIP = 1, run as a MIQP problem, trying to make the third variable
integer valued. Otherwise run as a pure QP problem. Default MIP = 0. |
|
DEFPARAM |
If 1, use default CPLEX parameters for fastest execution. |
|
If 0, disable cuts and presolve for slower execution. |
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
Simple test of calling
CPLEX Matlab level 1 interface to solve a QP or MIQP problem.
The problem is
|
|
f(x) = x12 + x22 + x32 |
|
subject to |
x1 + 2x2 − x3 |
= |
4 |
|
x1 − x2 + x3 |
= |
−2 |
|
|
−10 ≤ xi ≤ 10, i=1,2,3 |
|
x3 integer if MIP 0 |
|
M-files Used
cplex.m
C.12 cpxTestQP2
Purpose
Simple test of calling CPLEX Matlab level 1 interface to solve a mixed integer quadratic (MIQP) problem.
Calling Syntax
x = cpxTestQP2(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. |
|
DEFPARAM |
If 1, use default parameters, presolve, cuts, dual simplex for fastest execution. |
|
If 0, do not use presolve or cuts. Choose Primal Simplex for slower execution. |
|
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. |
Description
Simple test of MIQP problem running CPLEX .
The problem is defined as
|
|
f(x) = 2x12 − 2x1x2 + 2x22 −6x1 |
|
s/t |
0 |
≤ |
x1,x2 |
≤ |
∞ |
|
|
|
x1 + x2 |
≤ |
1.9 |
|
|
x1 integer if MIP 0. |
|
M-files Used
cplex.m
C.13 cpxTestConflict
Purpose
Demonstration of the TOMLAB /CPLEX Conflict Refinement feature.
Calling Syntax
x = cpxTestConflict()
Description
Define the linear sos1 constraints explicitly. Modify a bound to
produce an infeasibility and invoke CPLEX again with Conflict
Refinement enabled.
« Previous « Start » Next »