ibm cplex optimization studio 12.7 - benders, modeling assistance, etc
TRANSCRIPT
© 2016 IBM Corporation
IBM CPLEX Optimizer 12.7Benders decomposition, Modeling Assistance, …
Xavier Nodet, Program Manager, CPLEX Optimization Studio
© 2016 IBM Corporation2
PERFORMANCE
© 2016 IBM Corporation3
0
5
10
15
20
25
30
35
40
45
50
0
100
200
300
400
500
600
700
10.0 (2006)
11.0 (2007)
12.1 (2009)
12.2 (2010)
12.4 (2011)
12.5.0 (2012)
12.6.0 (2013)
12.6.1 (2014)
12.6.3 (2015)
12.7.0 (2016)
tota
l spe
edup
num
ber o
f tim
eout
sCPLEX MILP performance evolution
³10 sec
³100 sec
³1000 sec
Date: 6 November 2016Testset: MILP: 3893 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
© 2016 IBM Corporation4
0
0,2
0,4
0,6
0,8
1
>1s >10s >100s
1,00
1,00
1,00
0,99
0,97
0,93
CPLEX 12.6.3
CPLEX 12.7.0
Date: 6 November 2016Testset: LP: 2271 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
CPLEX 12.6.3 vs.12.7.0: LP performance improvement
LP barrier(12 threads)
626 models 123 models
Time limits:1 / 0
1.01x 1.07x
0
0,2
0,4
0,6
0,8
1
>1s >10s >100s
1,00
1,00
1,00
0,95
0,92
0,83
CPLEX 12.6.3
CPLEX 12.7.0
LP barrier with Xover(12 threads)
696 models 165 models
Time limits:3 / 3
1.05x 1.21x
1.03x
1.09x
299 models
355 models
© 2016 IBM Corporation5
0
0,2
0,4
0,6
0,8
1
>1s >10s >100s
1,00
1,00
1,00
0,92
0,90
0,85
CPLEX 12.6.3
CPLEX 12.7.0
Date: 6 November 2016Testset: MILP: 4256 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
Deterministic parallel MILP (12 threads)
2048 models
667 models
Time limits:55 / 24
1.08x 1.18x1.11x
1254 models
§ MILP improvements summary-Root presolve: 2%-Propagation of implications in node presolve: 3%-Root and node probing: 3%-Node cuts (separation and filtering): 3%-Heuristics: 2%-Branching: 3%
CPLEX 12.6.3 vs.12.7.0: MILP performance improvement
© 2016 IBM Corporation6
0
0,2
0,4
0,6
0,8
1
>0s >1s >10s
1,00
1,00
1,00
0,94
0,89
0,85
CPLEX 12.6.3
CPLEX 12.7.0
Date: 6 November 2016Testset: MIQP: 365 models Machine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
CPLEX 12.6.3 vs.12.7.0: MIQP performance improvement
Convex MIQP(12 threads)
263 models 84 models
Time limits:3 / 0
1.07x 1.18x1.13x
123 models
§ MIQP improvements summary-Node cuts (separation and filtering): 7%-Tuning of node probing effort: 6%
© 2016 IBM Corporation7
0
0,2
0,4
0,6
0,8
1
>0s >1s >10s
1,00
1,00
1,00
0,92
0,87
0,78
CPLEX 12.6.3
CPLEX 12.7.0
Date: 6 November 2016Testset: MIQCP: 326 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
CPLEX 12.6.3 vs.12.7.0: MIQCP performance improvement
Convex MIQCP(12 threads)
259 models 88 models
Time limits:5 / 1
1.09x 1.29x1.15x
154 models
§ MIQCP improvements summary (all for Outer Approximation, OA)-More aggressive reliability branching: 4%-Better synchronization of cone cuts in the tree: 2%-Better integration between cone cuts and QCP relaxation:
• Repeatedly solve QCP relaxation at the root, to refine OA with cone cuts: 4%• Solve QCP relaxation in the tree, to refine the OA with cone cuts: 10%
© 2016 IBM Corporation8
0
0,2
0,4
0,6
0,8
1
>0s >1s >10s
1,00
1,00
1,00
0,79
0,61
0,35
CPLEX 12.6.3
CPLEX 12.7.0
Date: 6 November 2016Testset: Non-convex (MI)QP: 742 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threads, deterministicTimelimit: 10,000 sec
Non-convex (MI)QP(12 threads)
447 models 79 models
Time limits:12 / 1
1.27x 2.83x1.65x
157 models
§ All the improvement comes from newly added cutting planes: Cuts from Reformulation-Linearization Techniques (RLT-cuts)- H. D. Sherali and A. Alameddine, “A new reformulation-linearization technique for bilinear
programming problems”, Journal of Global Optimization 2, 379-410, 1992.- Implemented in CPLEX within the FP7-PEOPLE-2012-ITN Marie Curie EU Project MINO, see also:
• P. Bonami, A. Lodi, J. Schweiger, A. Tramontani, "Solving standard quadratic programming by cutting planes", Techical Report DS4DM-2016-001, 2016.
CPLEX 12.6.3 vs.12.7.0: Global (MI)QP performance improvement
© 2016 IBM Corporation9
BENDERS DECOMPOSITION
© 2016 IBM Corporation10
Principle of the Benders decomposition
§ Iterative approach§ Complete problem decomposed into a single master (MIP) problem, and a series of LP sub-
problems.§ Master problem defined by a set of variables, and contains all the constraints that involve
these variables.§ Given a solution of the master problem, the sub-problems allow to generate:
• An optimality cut that refines their contribution to the objective value, or• A feasibility cut if that solution is not feasible for a sub-problem
• Cuts derive from duality arguments, hence the need for the sub-problems to be LPs
Mas
ter
SP2
SP3
SP1
© 2016 IBM Corporation11
Typical use cases
§ The complete model is big, but the sub-problems decompose into manageable pieces. Example: scenario-based stochastic problems
§ No decomposition for the sub-problem, but the master and the sub-problem have a much simpler structure. Example: facility location, where Benders decomposition turns tons of variable upper bounds (99% of the constraints in the model) into simple bounds.
In the complete problem:𝑦"# ≤ 𝑥"
These constraints disappear from the master model, and appear in the sub-problem as𝑦"# ≤ 0,1 , depending on the solution for 𝑥" in the master problem
§ Similar to above, when master can enumerate much faster than the complete model and yet the bounds that it provides are not much worse. Example: some network design models.
© 2016 IBM Corporation12
Annotations
§ Annotations provide information to CPLEX that doesn’t belong to the definition of the model§ Example: defining the block structure for Benders decomposition algorithm
§ All elements of a model (objective, variables, constraints) can be annotated§ A given annotation is defined by a name (the key), a type (for the value), and a default
value§ For a given model element, and a given key, a single value can be attached
§ For Benders:- Key is “cpxBendersPartition”- Type is long- Value 0: this variable is a master variable- Value k>0: this variable belongs to sub-problem k.
© 2016 IBM Corporation13
benders strategy parameter
§ benders strategy 1: user-specified decomposition- CPLEX will use the decomposition specified as is
§ benders strategy 2: CPLEX refines user’s decomposition- The master variables are left- Each sub-problem will be further decomposed if possible- User can simply specify the master variables, and let CPLEX do the rest
§ benders strategy 3: full automatic decomposition- A user-specified decomposition is ignored- Integer variables go into the master problem- Continuous variables in a sub-problem- Decompose this sub-problem if possible
§ benders strategy 0 (default)- If a decomposition was specified: refine it, and run benders algorithm- Otherwise, run regular Brand-and-Bound
© 2016 IBM Corporation14
Computational results
§ Benders decomposition is not a silver bullet!
§ Full automatic decomposition, on our MIP library, models solved in 10 sec or more, threshold of 2x ratio, Benders is better on 5% of the models.
§ But it can really shine!
§ Specific benchmark set of 329 models for Benders, some with manual decomposition§ Timeouts: 7 instead of 85§ 3x on all models§ 10x on 100 sec or more
© 2016 IBM Corporation15
0
0,2
0,4
0,6
0,8
1
>1s >10s >100s
0,18 0,18 0,16
0,94
0,68
0,330,
40
0,28
0,18
stochastic
non stochastic
Benders B&C compared to “regular” B&C
Date: 6 November 2016Testset: 390 modelsMachine: Intel X5650 @ 2.67GHz, 24 GB RAM, 12 threadsTimelimit: 10,000 sec
5.69x 6.40x5.47x
2.53x3.57x
5.41x
Stochastic Non stochastic# models # wins/losses # timeout
(regular B&C / Benders B&C)
# models # wins/losses # timeout (regular B&C / Benders B&C)
> 1sec 168 130/37 76/17 152 61/80 6/4
> 10 secs 163 126/37 76/17 86 52/32 6/4
> 100 secs 149 117/32 76/17 44 30/13 6/4
1.06x
1.48x
3.07x
Computational results
© 2016 IBM Corporation16
RUNSEEDS, MODELING ASSISTANCE
© 2016 IBM Corporation17
Performance variability:seemingly neutral changes lead to a big variation in solution time
By now a well known issue in MIP:l Danna (MIP workshop, 2008)l Koch et al. (Math. Prog. Comp. 2011)l Fischetti and Monaci (Op. Res. 2014)l Achterberg and Wunderling (Facets of Comb. Optimization, 2013)l Lodi and Tramontani (INFORMS 2013 Tutorial)
MIP solver ingredientsl Heuristicsl Cutting planes
l Branching variable selectionl ...
Changes in platform, code, parameter settings …→ may have (big) impact on any ingredient→ on the whole solution process→ (sometimes) hard to get robust performance
© 2016 IBM Corporation18
model seed 1 seed 2 seed 3 seed 4 seed 5 min max max/min
map14 65.41 61.77 62.82 62.35 64.96 61.77 65.41 1.06
rococoB10-011000
1582.72 811.05 844.39 2223.25 740.78 740.78 2223.25 3.00
neos-911880
315.22 10000.14 354.19 1.71 27.40 1.71 10000.14 5848.04
3 instances from MIPLIB2010 test set, run on 5 different random seedsPerformance variability exists and has massive effects
© 2016 IBM Corporation19
1
10
100
1000
model seed 1 seed 2 seed 3 seed 4 seed 5 min max max/min
map14 65.41 61.77 62.82 62.35 64.96 61.77 65.41 1.06
rococoB10-011000
1582.72 811.05 844.39 2223.25 740.78 740.78 2223.25 3.00
neos-911880
315.22 10000.14 354.19 1.71 27.40 1.71 10000.14 5848.04
3 instances from MIPLIB2010 test set, run on 5 different random seedsPerformance variability exists and has massive effects
All solvable instances, run on 5 different seeds, max/min truncated at 1000, log scale
© 2016 IBM Corporation20
1
10
100
1000
model seed 1 seed 2 seed 3 seed 4 seed 5 min max max/min
map14 65.41 61.77 62.82 62.35 64.96 61.77 65.41 1.06
rococoB10-011000
1582.72 811.05 844.39 2223.25 740.78 740.78 2223.25 3.00
neos-911880
315.22 10000.14 354.19 1.71 27.40 1.71 10000.14 5848.04
Performance variability exists and has massive effects
≤ 2 ok 131
]2, 4] shaky 53
> 4 bad 28
rough classification
All solvable instances, run on 5 different seeds, max/min truncated at 1000, log scale
3 instances from MIPLIB2010 test set, run on 5 different random seeds
© 2016 IBM Corporation21
To assess performance variability with CPLEX:
model seed 1 seed 2 seed 3 seed 4 seed 5 min max max/min
map14 65.41 61.77 62.82 62.35 64.96 61.77 65.41 1.06
rococoB10-011000
1582.72 811.05 844.39 2223.25 740.78 740.78 2223.25 3.00
neos-911880
315.22 10000.14 354.19 1.71 27.40 1.71 10000.14 5848.04
3 instances from MIPLIB2010 test set, run on 5 different random seeds
l run one model with different random seeds
l new command in the interactive: tools→runseeds
Performance variability exists and has massive effects
l surrogate for random perturbation of the model
© 2016 IBM Corporation22
CPLEX> read beasleyC3.mps 1. Read model
© 2016 IBM Corporation23
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0
1. Read model
2. Set parameters (if any)
l parameters set here apply to every run!
© 2016 IBM Corporation24
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
l runs model with different random seedsl default is 30 random seedsl each solve starts from scratchl CPLEX compiles statistics for each run
© 2016 IBM Corporation25
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
© 2016 IBM Corporation26
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
© 2016 IBM Corporation27
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
© 2016 IBM Corporation28
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
solution information, should be consistentotherwise → modeling assistance
© 2016 IBM Corporation29
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
solution effort,indicates variability
© 2016 IBM Corporation30
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
© 2016 IBM Corporation31
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect results
© 2016 IBM Corporation32
CPLEX> read beasleyC3.mpsCPLEX> set mip tolerance mipgap 0CPLEX> set mip tolerance absmipgap 0CPLEX> tools runseeds
1. Read model
2. Set parameters (if any)
3. Launch
4. Wait . . .
====== runseeds statistics of 30 runs
exit sol objective gap iteration node runtime dettimerun code stat value (%) count count seconds ticks
1 0 101 754 0.00 478311 4051 10.68 6941.202 0 101 754 0.00 378060 3991 8.91 5653.563 0 101 754 0.00 421786 4021 10.04 6489.83
. . .30 0 101 754 0.00 413233 3969 9.06 5775.45
Optimization status codes:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 754 0.00 459225 4009 10.84 7021.98std dev: 1.87205e-10 0.00 66658 43 1.07 779.37
Exit codes:0 : No error
5. Inspect resultsStatistics per run
Failed runs
Aggregated statistics
© 2016 IBM Corporation33
aflow30a
Some example results
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: 1158 0.00 110298 3980 3.19 1883.01std dev: 0 0.00 24585 779 0.30 181.44
l A stable model
© 2016 IBM Corporation34
gmu-35-40
aflow30a
Some example results
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: 1158 0.00 110298 3980 3.19 1883.01std dev: 0 0.00 24585 779 0.30 181.44
l A stable model
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: -2.40673e+06 0.00 36824708 4624403 566.02 339839.59std dev: 0 0.00 94077727 12739496 1607.25 935535.50
l A model with high variability
© 2016 IBM Corporation35
Hurink_edata_mt06_lazy
aflow30a
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: 49.2667 0.00 499151265 72138619 5946.96 3269407.19std dev: 5.52695 0.00 532709392 107808642 7681.00 4400455.20
Some example results
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: 1158 0.00 110298 3980 3.19 1883.01std dev: 0 0.00 24585 779 0.30 181.44
l A stable model
l A suspicious model
l A model with high variability
standard deviation in objective → indicator for numerical problems→ modeling assistance
objective gap iteration node runtime dettimevalue (%) count count seconds ticks
101 : integer optimal solution (30 times)average: -2.40673e+06 0.00 36824708 4624403 566.02 339839.59std dev: 0 0.00 94077727 12739496 1607.25 935535.50
© 2016 IBM Corporation36
Modeling assistance
© 2016 IBM Corporation37
Modeling assistancel detect problems in model data (small numbers, …)l detect bad modeling constructs (big-M, ...)
→ improve numerical robustness
l issues collected from years of CPLEX support and developmentl issues with problem datal issues in the model formulationl issues with parameter settingsl issues during the solution process
l CPLEX scans your model and looks for these issuesl for each issue found a warning is printedl enabled by parameter setting (disabled by default)
© 2016 IBM Corporation38
Modeling assistancel detect problems in model data (small numbers, …)l detect bad modeling constructs (big-M, ...)
l issues collected from years of CPLEX support and developmentl issues with problem datal issues in the model formulationl issues with parameter settingsl issues during the solution process
l CPLEX scans your model and looks for these issuesl for each issue found a warning is printedl enabled by parameter setting (disabled by default)l CPX_PARAM_DATACHECK 0 – off
solveinput
→ improve numerical robustness
© 2016 IBM Corporation39
Modeling assistancel detect problems in model data (small numbers, …)l detect bad modeling constructs (big-M, ...)
l issues collected from years of CPLEX support and developmentl issues with problem datal issues in the model formulationl issues with parameter settingsl issues during the solution process
l CPLEX scans your model and looks for these issuesl for each issue found a warning is printedl enabled by parameter setting (disabled by default)l CPX_PARAM_DATACHECK 0 – off
solveinput &check
1 – check for invalid data (dup indices, NaNs, ...)
→ improve numerical robustness
© 2016 IBM Corporation40
Modeling assistancel detect problems in model data (small numbers, …)l detect bad modeling constructs (big-M, ...)
l issues collected from years of CPLEX support and developmentl issues with problem datal issues in the model formulationl issues with parameter settingsl issues during the solution process
l CPLEX scans your model and looks for these issuesl for each issue found a warning is printedl enabled by parameter setting (disabled by default)l CPX_PARAM_DATACHECK 0 – off
2 – check for common modeling issuessolve
modeling assistance
modeling assistance
input &check
1 – check for invalid data (dup indices, NaNs, ...)
→ improve numerical robustness
© 2016 IBM Corporation41
Modeling assistance
Quick reminder: Assessing numerics in CPLEX (for MIP)
© 2016 IBM Corporation42
Modeling assistance
Quick reminder: Assessing numerics in CPLEX (for MIP)
l Solution quality: CPLEX> display solution qualityMILP objective 2.1961300000e+05MILP solution norm |x| (Total, Max) 4.22897e+06 5.34130e+05MILP solution error (Ax=b) (Total, Max) 1.02709e-09 4.36557e-11MILP x bound error (Total, Max) 0.00000e+00 0.00000e+00MILP x integrality error (Total, Max) 0.00000e+00 0.00000e+00MILP slack bound error (Total, Max) 3.55271e-15 2.22045e-16
© 2016 IBM Corporation43
Modeling assistance
Quick reminder: Assessing numerics in CPLEX (for MIP)
l Solution quality: CPLEX> display solution qualityMILP objective 2.1961300000e+05MILP solution norm |x| (Total, Max) 4.22897e+06 5.34130e+05MILP solution error (Ax=b) (Total, Max) 1.02709e-09 4.36557e-11MILP x bound error (Total, Max) 0.00000e+00 0.00000e+00MILP x integrality error (Total, Max) 0.00000e+00 0.00000e+00MILP slack bound error (Total, Max) 3.55271e-15 2.22045e-16
l Kappa statistics: track condition number of basis matricesCPLEX> set mip strategy kappa 2CPLEX> optimize…CPLEX> display solution kappaMax condition number: 2.7435e+13Percentage (number) of stable bases: 77.51% (11908)Percentage (number) of suspicious bases: 19.31% (2966)Percentage (number) of unstable bases: 3.18% (489)Percentage (number) of ill-posed bases: 0.00% (0)Attention level: 0.011480
© 2016 IBM Corporation44
Modeling assistance
Quick reminder: Assessing numerics in CPLEX (for MIP)
l Solution quality: CPLEX> display solution qualityMILP objective 2.1961300000e+05MILP solution norm |x| (Total, Max) 4.22897e+06 5.34130e+05MILP solution error (Ax=b) (Total, Max) 1.02709e-09 4.36557e-11MILP x bound error (Total, Max) 0.00000e+00 0.00000e+00MILP x integrality error (Total, Max) 0.00000e+00 0.00000e+00MILP slack bound error (Total, Max) 3.55271e-15 2.22045e-16
l Kappa statistics: track condition number of basis matricesMax condition number:
Percentage (number) of stable bases:
Percentage (number) of suspicious bases:
Percentage (number) of unstable bases:
Percentage (number) of ill-posed bases:
Attention level:
usually no problemdouble checkbe concerned
© 2016 IBM Corporation45
aTx ≤ My y binary, M huge
y = 0 → aTx ≤ 0y = 1 → aTx ≤ M
y used to model availabilityof a resource
Issues with problem formulation: big-M constraints
resource not availableresource available
© 2016 IBM Corporation46
aTx ≤ My y binary, M huge
y = 0 → aTx ≤ 0y = 1 → aTx ≤ M
y used to model availabilityof a resource
Typically M is much larger than ai→ wide range of coefficients in the coefficient matrix
causes numerical trouble
Issues with problem formulation: big-M constraints
resource not availableresource available
© 2016 IBM Corporation47
aTx ≤ My y binary, M huge
y = 0 → aTx ≤ 0y = 1 → aTx ≤ M
y used to model availabilityof a resource
Typically M is much larger than ai→ wide range of coefficients in the coefficient matrix
causes numerical trouble
→ use indicator constraints y = 0 → aTx ≤ 0y = 1 → aTx ≤ M
Issues with problem formulation: big-M constraints
resource not availableresource available
often one of the two can be expressed as bound on a variable
© 2016 IBM Corporation48
FALL_12_3
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
Issues with problem formulation: big-M constraints
A model with big-M constraints
© 2016 IBM Corporation49
FALL_12_3
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
Issues with problem formulation: big-M contraints
CPLEX Warning 1042: In constraint 'c1109', binary variable 'x257' is linked with variable 'x2079' having ratio 1e+06.
c1109: - 1000000 x257 + x2079 ≤ 0
x257 binary, x2079 ≥ 0
A model with big-M constraints
© 2016 IBM Corporation50
FALL_12_3
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
Issues with problem formulation: big-M constraints
CPLEX Warning 1042: In constraint 'c1109', binary variable 'x257' is linked with variable 'x2079' having ratio 1e+06.
c1109: - 1000000 x257 + x2079 ≤ 0
x257 binary, x2079 ≥ 0x257 = 0 → x2079 = 0x257 = 1 → x2079 ≤ 1000000
A model with big-M constraints
© 2016 IBM Corporation51
FALL_12_3
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
Issues with problem formulation: big-M constraints
CPLEX Warning 1042: In constraint 'c1109', binary variable 'x257' is linked with variable 'x2079' having ratio 1e+06.
c1109: - 1000000 x257 + x2079 ≤ 0
x257 binary, x2079 ≥ 0x257 = 0 → x2079 = 0x2079 ≤ 1000000
A model with big-M constraints
© 2016 IBM Corporation52
FALL_12_3
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
Issues with problem formulation: big-M constraints
CPLEX Warning 1042: In constraint 'c1109', binary variable 'x257' is linked with variable 'x2079' having ratio 1e+06.
c1109: - 1000000 x257 + x2079 ≤ 0
x257 binary, x2079 ≥ 0x257 = 0 → x2079 = 0x2079 ≤ 1000000
Max condition number: 1.6814e+13Percentage (number) of stable bases: 8.06% Percentage (number) of suspicious bases: 89.66% Percentage (number) of unstable bases: 2.28% Percentage (number) of ill-posed bases: 0.00% Attention level: 0.015804
2.2289e+1380.15% 19.83% 0.02% 0.00% 0.002048
→ numerics improve significantly
A model with big-M constraints
© 2016 IBM Corporation53
l CPLEX uses IEEE double precision arithmetic (quad precision in some places)l not every rational number has an exact representation→ round-off error will occur
∑i in {1, ..., k} 1/k xi = 1
Issues with problem data: Single precision input data
Consider fraction 1/k and a simple constraint
© 2016 IBM Corporation54
l CPLEX uses IEEE double precision arithmetic (quad precision in some places)l not every rational number has an exact representation→ round-off error will occur
∑i in {1, ..., k} 1/k xi = 1
single double1/k Δ Δ(∑) Δ Δ(∑)1/3 9.9e-9 3.0e-8 1.9e-17 5.6e-171/5 3.0e-9 1.5e-8 1.1e-17 5.6e-171/6 5.0e-9 3.0e-8 9.3e-18 5.6e-17
only 1/k in singlerest in double!
xi exact integer→infeasible by at least 1e-8 with single precision data→in practice often a lot worse
Issues with problem data: Single precision input data
Consider fraction 1/k and a simple constraint
∆ to exact value
© 2016 IBM Corporation55
l Obvious warning
→ Fix data generation
Issues with problem data: Single precision input data
xi exact integer→infeasible by at least 1e-8 with single precision data→in practice often a lot worse
CPLEX Warning 1036: Coefficient for %s in %s looks like %d/%d in single precision
© 2016 IBM Corporation56
CPLEX Warning 1036: Coefficient for %s in %s looks like %d/%d in single precision
l Obvious warning
→ Fix data generation
l But alsoCPLEX Warning 1047: Coefficients in %s are fractions and can be scaled with %d/%d
→ scale row to get exact values
∑i in {1, ..., k} xi = k∑i in {1, ..., k} 1/k xi = 1 →
Issues with problem data: Single precision input data
xi exact integer→infeasible by at least 1e-8 with single precision data→in practice often a lot worse
© 2016 IBM Corporation57
Issues with problem data: Single precision input data
ns2118727.mps.gz
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
A model with single precision data
© 2016 IBM Corporation58
Issues with problem data: Single precision input data
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
CPLEX Warning 1036: Coefficient for variable 'C7932' in constraint 'R1024' looks like 1/24 in single precision.
R1024: C0017 - C0700 - C0926 + C2957 + C5189 - C5190 - 0.0416667 C7932 = 0
definitely looks truncated/rounded
A model with single precision data
© 2016 IBM Corporation59
Issues with problem data: Single precision input data
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
CPLEX Warning 1036: Coefficient for variable 'C7932' in constraint 'R1024' looks like 1/24 in single precision.
R1024: C0017 - C0700 - C0926 + C2957 + C5189 - C5190 - 0.0416667 C7932 = 0
8.7299e+06100.00%
0.00% 0.00% 0.00%
definitely looks truncated/rounded
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
A model with single precision data
© 2016 IBM Corporation60
Issues with problem data: Single precision input data
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
CPLEX Warning 1036: Coefficient for variable 'C7932' in constraint 'R1024' looks like 1/24 in single precision.
R1024: C0017 - C0700 - C0926 + C2957 + C5189 - C5190 - 0.0416667 C7932 = 0
8.7299e+06100.00%
0.00% 0.00% 0.00%
solution time from 120 seconds
definitely looks truncated/rounded
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
90 seconds
A model with single precision data
© 2016 IBM Corporation61
Issues with problem data: Single precision input data
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
CPLEX Warning 1036: Coefficient for variable 'C7932' in constraint 'R1024' looks like 1/24 in single precision.
R1024: C0017 - C0700 - C0926 + C2957 + C5189 - C5190 - 0.0416667 C7932 = 0
8.7299e+06100.00%
0.00% 0.00% 0.00%
solution time from 120 seconds
definitely looks truncated/rounded
Max condition number: 1.0978e+14Percentage (number) of stable bases: 67.59% Percentage (number) of suspicious bases: 31.28% Percentage (number) of unstable bases: 0.97% Percentage (number) of ill-posed bases: 0.16% Attention level: 0.007666
90 seconds
A model with single precision data
Attention
blindly changing coefficients may change feasible region
→ may end up solving a different model
→ change model generation, not model
© 2016 IBM Corporation62
l Numbers below CPLEX default tolerances→ essentially 0
→ Fix numbers or tighten tolerance parameters
l Numbers too small for the solver (smaller than 1e-13)→ essentially 0
→ Fix numbers
l Numbers larger than CPX_INFBOUND→ CPLEX will consider them as infinity
→ Fix numbers or, e.g., remove constraints with right-hand side > CPX_INFBOUND
Issues with problem data: extreme numbers
l feasibility tolerancel optimality tolerancel numerical emphasisl ...
© 2016 IBM Corporation63
l CPX_PARAM_EPGAP: stop if relative MIP gap drops below a value
l relative MIP gap (in CPLEX): best integer – best objective1e-10 + |best integer|
Issues with parameter settings: relative MIP gap
© 2016 IBM Corporation64
l CPX_PARAM_EPGAP: stop if relative MIP gap drops below a value (default 1e-4)
l relative MIP gap (in CPLEX): best integer – best objective1e-10 + |best integer|
l Objective: min aTx + KaTx* + K – (aTx' + K) aTx* – aTx'1e-10 + |aTx* + K| 1e-10 + |aTx* + K|
Issues with parameter settings: relative MIP gap
→ gap:
© 2016 IBM Corporation65
l CPX_PARAM_EPGAP: stop if relative MIP gap drops below a value
l relative MIP gap (in CPLEX): best integer – best objective1e-10 + |best integer|
l Objective: min aTx + KaTx* + K – (aTx' + K) aTx* – aTx'1e-10 + |aTx* + K| 1e-10 + |aTx* + K|
l K huge → gap small, independent of aTx* and aTx'
Issues with parameter settings: relative MIP gap
→ gap:
© 2016 IBM Corporation66
l CPX_PARAM_EPGAP: stop if relative MIP gap drops below a value
l relative MIP gap (in CPLEX): best integer – best objective1e-10 + |best integer|
l Objective: min aTx + KaTx* + K – (aTx' + K) aTx* – aTx'1e-10 + |aTx* + K| 1e-10 + |aTx* + K|
l K huge → gap small, independent of aTx* and aTx'
CPLEX Warning 1037: Solution optimal within relative optimality tolerance of %g, but not optimal if objective offset of value %g is removed
l related
l modeling assistance warning
CPLEX Warning 1038: Solution optimal within relative optimality tolerance of %g, but not optimal within absolute optimality tolerance of value %g
Issues with parameter settings: relative MIP gap
→ gap:
→ fix K or adapt CPX_PARAM_EPGAP
© 2016 IBM Corporation67
l CPLEX tracks condition number of basis matrices in LP solve.l Large number of bases with large condition number
→ potential numerical problems→ inexact/incorrect answers
l Numerical trouble while solving the problem→ Can you trust the results? How much can you trust them?
→ Check/fix data, check solution quality, use numericalemphasis, tighten tolerances
Issues during solve: big condition numbers
CPLEX Warning 1033: Detected 1277 suspicious condition number(s) >= 1e+07.CPLEX Warning 1034: Detected 30 unstable condition number(s) >= 1e+10.
l Solving ns2034125
© 2016 IBM Corporation68
BIGM_COEF one very big coefficient in row █ █
BIGM_TO_IND constraint can be replaced by indicator █ █
BIGM_VARBOUND variable bound constraint with very large bound █ █
EPGAP_LARGE solution optimal only due to large CPX_PARAM_EPGAP █ █ █
EPGAP_OBJOFFSET solution optimal only due to large objective offset █ █
FRACTION_SCALING rows can be scaled to get exact value █ █
*_LARGE_NUM suspiciously large number █ █
*_SMALL_NUM suspiciously small number █
CANCEL_TOL non-zero less than cancel tolerance █ █ █
FEAS_TOL rhs smaller than feasibility tolerance █ █ █
OPT_TOL objective coefficient smaller than optimality tolerance █ █ █
QOPT_TOL quadratic objective coefficient smaller than optimality tolerance █ █ █
SINGLE_PRECISION single precision data █
SYMMETRY_BREAKING_INEQ chain of symmetry breaking inequalities █ █
WIDE_COEFF_RANGE wide range of coefficients █ █
KAPPA_* bad kappa values detected during solve █ █ █ █
Potential issues in problem dataPotential issues in problem formulation
Potential issues in parameter settingsPotential issues in solve
Overview of modeling assistance warnings
© 2016 IBM Corporation69
l momentum1.mps.gz (absolute and relative MIP gap 0):
Combining modeling assistance and runseeds
l runseeds on original model:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 109143 0.00 40986027 1128777 2881.88 1725072.05std dev: 0.000312912 0.00 27028241 726250 1807.30 1071736.66
© 2016 IBM Corporation70
l momentum1.mps.gz (absolute and relative MIP gap 0):
Combining modeling assistance and runseeds
l runseeds on original model:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 109143 0.00 40986027 1128777 2881.88 1725072.05std dev: 0.000312912 0.00 27028241 726250 1807.30 1071736.66
l big-M constraintsl Single precision datal scaled rowsl wide coefficient ranges
l fix modeling assistance warnings:
© 2016 IBM Corporation71
l momentum1.mps.gz (absolute and relative MIP gap 0):
Combining modeling assistance and runseeds
→ iteration count, solution time, number of nodes reduced→ variability in iteration count, solution time, number of nodes reduced
l runseeds on original model:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 109143 0.00 40986027 1128777 2881.88 1725072.05std dev: 0.000312912 0.00 27028241 726250 1807.30 1071736.66
l runseeds on model with all warnings fixed:objective gap iteration node runtime dettime
value (%) count count seconds ticks101 : integer optimal solution (30 times)average: 109143 0.00 34108977 921646 2310.04 1400198.34std dev: 0.000580749 0.00 20783473 564391 1237.40 750744.53
l fix modeling assistance warnings
© 2016 IBM Corporation72
Be careful when auto-fixing warningsl Model ns2122603 from “unstable” MIPLIB 2010 testsetl gives these warnings:
Detected constraint with wide range of coefficients. In constraint 'R12374' the ratio of largest and smallest (in absolute value) coefficients is 2.4e+09
Coefficient for variable 'C10462' in constraint 'R12374' looks like 1/24 in single precision.
© 2016 IBM Corporation73
Be careful when auto-fixing warningsl Model ns2122603 from “unstable” MIPLIB 2010 testsetl gives these warnings:
Detected constraint with wide range of coefficients. In constraint 'R12374' the ratio of largest and smallest (in absolute value) coefficients is 2.4e+09
Coefficient for variable 'C10462' in constraint 'R12374' looks like 1/24 in single precision.
l Solve original model:Max condition number: 1.7025e+20Percentage (number) of stable bases: 0.00% (0)Percentage (number) of suspicious bases: 0.00% (0)Percentage (number) of unstable bases: 0.00% (0)Percentage (number) of ill-posed bases: 100.00% (1)Attention level: 1.000000
CPLEX stops at root with sub-optimal solution
© 2016 IBM Corporation74
Be careful when auto-fixing warningsl Model ns2122603 from “unstable” MIPLIB 2010 testsetl gives these warnings:
Detected constraint with wide range of coefficients. In constraint 'R12374' the ratio of largest and smallest (in absolute value) coefficients is 2.4e+09
Coefficient for variable 'C10462' in constraint 'R12374' looks like 1/24 in single precision.
→ replace by indicator
→ recompute coefficients
l Solve original model:Max condition number: 1.7025e+20Percentage (number) of stable bases: 0.00% (0)Percentage (number) of suspicious bases: 0.00% (0)Percentage (number) of unstable bases: 0.00% (0)Percentage (number) of ill-posed bases: 100.00% (1)Attention level: 1.000000
CPLEX stops at root with sub-optimal solution
3.4594e+150.55% (17)
93.47% (2906)5.92% (184)0.06% (2)0.027745
l Solve fixed
not too bad
© 2016 IBM Corporation75
Be careful when auto-fixing warningsl Model ns2122603 from “unstable” MIPLIB 2010 testsetl gives these warnings:
Detected constraint with wide range of coefficients. In constraint 'R12374' the ratio of largest and smallest (in absolute value) coefficients is 2.4e+09
Coefficient for variable 'C10462' in constraint 'R12374' looks like 1/24 in single precision.
→ replace by indicator
→ recompute coefficients
l Solve original model:Max condition number: 1.7025e+20Percentage (number) of stable bases: 0.00% (0)Percentage (number) of suspicious bases: 0.00% (0)Percentage (number) of unstable bases: 0.00% (0)Percentage (number) of ill-posed bases: 100.00% (1)Attention level: 1.000000
CPLEX stops at root with sub-optimal solution
3.4594e+150.55% (17)
93.47% (2906)5.92% (184)0.06% (2)0.027745
l Solve fixed
not too bad
l but: l fixed model gives super-optimal solutions!l solutions are infeasible in original model!
© 2016 IBM Corporation76
Be careful when auto-fixing warningsl Model ns2122603 from “unstable” MIPLIB 2010 testsetl gives these warnings:
Detected constraint with wide range of coefficients. In constraint 'R12374' the ratio of largest and smallest (in absolute value) coefficients is 2.4e+09
Coefficient for variable 'C10462' in constraint 'R12374' looks like 1/24 in single precision.
→ replace by indicator
→ recompute coefficients
l Solve original model:Max condition number: 1.7025e+20Percentage (number) of stable bases: 0.00% (0)Percentage (number) of suspicious bases: 0.00% (0)Percentage (number) of unstable bases: 0.00% (0)Percentage (number) of ill-posed bases: 100.00% (1)Attention level: 1.000000
CPLEX stops at root with sub-optimal solution
3.4594e+150.55% (17)
93.47% (2906)5.92% (184)0.06% (2)0.027745
l Solve fixed
not too bad
l but: l fixed model gives super-optimal solutions!l solutions are infeasible in original model! careful!
© 2016 IBM Corporation77
PIECEWISE LINEAR
© 2016 IBM Corporation78
PWL functions in the engine
§ Before 12.7, piecewise linear functions were available through Concert§ In C++, Java, .NET, but not C, Python and file formats§ Version 12.7 fixes that
§ Example of LP file format:
§ This specifies that y = f(x), where f is defined by the two points (20, 240) and (40, 400), has a slope before the first point equal to 0.5, and a slope after the last point of 2.0.
Minimize [...]
Subject To [...]
Pwlf: y = x 0.5 (20,240) (40,400) 2.0
End
© 2016 IBM Corporation79
‘NO CHECK’ MIP STARTS
© 2016 IBM Corporation80
‘No check’ MIP Start level
§ In can take time to check the validity of a MIP start, even when it indeed defines a complete feasible solution: CPLEX has to solve a fixed LP.
§ When the model has lazy constraints, checking the MIP start has to be delayed up to the end of the root node: may hurt performance
§ Version 12.7 introduces a new effort level: CPX_MIPSTART_NOCHECK
§ When used, CPLEX just assumes that he solution given is complete and feasible.Behavior is undefined otherwise.
© 2016 IBM Corporation
CPLEX Optimization Studio 12.7What’s new in CP Optimizer
© 2016 IBM Corporation82
CP Optimizer performance enhancements
V12.5.1 06/2013 V12.6 10/2013 V12.6.1 9/2014 V12.6.2 5/2015 V12.6.3 11/2015 V12.7 10/20160%
10%
20%
30%
40%
50%
60%
70%
Progress factor between CP Optimizer releases
Integer
Scheduling
© 2016 IBM Corporation83
CP Optimizer Interactive
■Equivalent of CPLEX interative for CP Optimizer
> cpoptimizer
Welcome to IBM(R) ILOG(R) CP Interactive Optimizer 12.7.0.05724-Y48 5724-Y49 5724-Y54 5724-Y55 5725-A06 5725-A29Copyright IBM Corp. 1990, 2016. All Rights Reserved
Type 'help' for a list of available commandsType 'help' followed by a command name for moreinformation on commands
CP-Optimizer>
© 2016 IBM Corporation84
CP Optimizer Interactive
■Main functionalitieso Read a problem instance as a .cpo file
CP-Optimizer> read myProblem.cpo
o Change parameters of the current problemCP-Optimizer> set Workers 1CP-Optimizer> set TemporalRelaxation Off
o Write the current problem (including parameter changes)CP-Optimizer> write model myModifiedProblem.cpo
© 2016 IBM Corporation85
CP Optimizer Interactive
■Main functionalitieso Launch CP Optimizer optimization on the current problem
CP-Optimizer> optimize
! ---------------------------------------------------------------! Minimization problem - 465 variables, 435 constraints
...! ---------------------------------------------------------------! Best Branches Non-fixed W Branch decision* 2145 901 0.15s 1 -
...! ---------------------------------------------------------------! Search terminated by abort, 6 solutions found.! Best objective : 2075
...! Search speed (br. / s) : 123617.5! ----------------------------------------------------------------
Solution found with objective 2075, search terminated by abort.
© 2016 IBM Corporation86
CP Optimizer Interactive
■Main functionalitieso Display all or some variables in a solution
CP-Optimizer> display solution J27O7J27O7[1: 809 -- 57 --> 866]
© 2016 IBM Corporation87
CP Optimizer Interactive
■Main functionalitieso Launch initial propagation at root node
CP-Optimizer> propagatePropagation succeeded.
o Display all or some variables domain after propagationCP-Optimizer> display solution J27O7J27O7[1: 431..IloIntervalMax-355 -- 57 --> 488..IloIntervalMax-298]
© 2016 IBM Corporation88
CP Optimizer Interactive
■Main functionalitieso Launch conflict refiner on an infeasible problem
CP-Optimizer> tools conflict
! ----------------------------------------------------------------------------! Conflict refining - 64 constraints, 60 variables! ----------------------------------------------------------------------------! Iteration Number of constraints* 1 64...* 9 1! Conflict refining terminated! ----------------------------------------------------------------------------! Conflict status : Terminated normally, conflict found! Conflict size : 1 constraint! Number of iterations : 9! Total memory usage : 965.3 kB! Conflict computation time : 0.15s! ----------------------------------------------------------------------------
Conflict found.
© 2016 IBM Corporation89
CP Optimizer Interactive
■Main functionalitieso Display current conflict
CP-Optimizer> display conflict
// ------ Conflict members: ---------------------------------------------------#line 116 "../../../examples/src/cpp/sched_conflict.cpp"12 >= RES1;
o Write current conflict as a .cpo fileCP-Optimizer> write conflict conflict.cpo
© 2016 IBM Corporation90
CP Optimizer Interactive
■Main functionalitieso Optimizes the current problem using different seeds and displays
some statisticsCP-Optimizer> tools runseeds 5
Benchmarking current problem on 5 runs...Run Solution Proof Time (s) Objective---------------------------------------------------------1 1 1 5.727 9302 1 1 4.94 9303 1 1 6.39 9304 1 1 5.59 9305 1 1 4.068 930---------------------------------------------------------All runs completeAverage 100 % 100 % 5.343 930Std dev 0.8793 0Min 4.068 930Max 6.39 930
© 2016 IBM Corporation91
CPO file format
■CPO file format is low-level specification of optimization problem.■CP Optimizer can both read and write .cpo files.
// Decision variables:
Belgium = intVar(1..4);Denmark = intVar(1..4);France = intVar(1..4);Germany = intVar(1..4);Luxembourg = intVar(1..4);Netherlands = intVar(1..4);
/* Constraints: */
Belgium != France;
Belgium != Germany;
Belgium != Netherlands;
Belgium != Luxembourg;
Denmark != Germany;
France != Germany;
France != Luxembourg;
Germany != Luxembourg;
Germany != Netherlands;
parameters {
SearchType = DepthFirst;}
© 2016 IBM Corporation92
New: Starting point in CPO file format
■User can specify an initial solution to speed up search.■The solution can specify ranges and can omit some variables.
// Decision variables:
Belgium = intVar(1..4);Denmark = intVar(1..4);France = intVar(1..4);Germany = intVar(1..4);Luxembourg = intVar(1..4);Netherlands = intVar(1..4);
/* Constraints: */
Belgium != France;
Belgium != Germany;
Belgium != Netherlands;
Belgium != Luxembourg;
Denmark != Germany;
France != Germany;
France != Luxembourg;
Germany != Luxembourg;
Germany != Netherlands;parameters {
SearchType = DepthFirst;}
startingPoint {
France = 1..3;
Belgium = 2;
}
© 2016 IBM Corporation93
Syntax of starting point in CPO file format
Integer variables
x = intVar(1..10);y = intVar(1..10);z = intVar(1..10);
startingPoint {
x = 1;
y = 2..5;
z = intVar(2..5);}
Interval variables (scheduling)
a = intervalVar(optional, length=5);b = intervalVar(optional, length=2);c = intervalVar(optional);d = intervalVar(optional);
startingPoint {
a = (present, start=1, end=6);b = (present, start=10..15);c = intervalVar(absent);d = absent;
}
© 2016 IBM Corporation94
New warnings for starting point (examples)
§ Starting point value 1 is not in the domain of integer variable 'x'.§ Starting point range 1..5 is partly outside of the domain of integer variable
'y'.§ Starting point specifies attributes of absent interval variable 'a'.§ Starting point for interval variable 'a' is inconsistent with its initial domain.
© 2016 IBM Corporation95
Modeling with Python for CP Optimizer 12.6.3
§ All CPO modeling function are available from Python§ Python operators overloaded for most common arithmetic and logical
operations.§ Solving is done transparently by submitting the model to a CPO solver
available on DOcloud:o No CPO solver to install locally.o Free trial available at https://developer.ibm.com/docloud/try-docloud-free/
§ Single Python package docplex for both CPO and CPLEX.§ try “pip install docplex” !
© 2016 IBM Corporation96
Python modeling example: Golomb rulerA Golomb ruler is a set of marks at integer positions along an imaginary ruler such that no two pairs of marks are the same dist
from docplex.cp.model import CpoModel
# Create modelmdl = CpoModel()
# Create an array of variables for positions of ruler marksORDER = 6marks = mdl.integer_var_list(ORDER, 0, (ORDER - 1) ** 2, "M")
# Force all marks distances to be differentmdl.add(mdl.all_diff([marks[i] - marks[j] for i in range(1, ORDER) for j in range(0, i)]))
# Avoid symmetric and mirror solutionsfor i in range(1, ORDER):
mdl.add(marks[i] > marks[i - 1])mdl.add((marks[1] - marks[0]) < (marks[ORDER - 1] - marks[ORDER - 2]))
# Minimize ruler size (position of the last mark)mdl.add(mdl.minimize(marks[ORDER - 1]))
# Solve modelmsol = mdl.solve()print("Solution: " + ' '.join(str(msol[v]) for v in marks))
> python golomb_ruler.pySolution: 0 1 4 10 12 17
© 2016 IBM Corporation97
Improvements to the Python API in CP Optimizer 12.7.0
§ Local solve, using CP Optimizer interactive as back-end§ With local solve only:
o propagation (available soon also on DOcloud),o conflict refiner,o retrieve multiple solutions with start/next implemented as iterator.
§ With local and DOcloud solve:o warm start
§ Support of numpy types and arrayso support of numpy arrays and numeric types
§ Integration in DOcloud Python workero allows to submit directly a Python source to DOcloudo all functions become available as for local solve.
© 2016 IBM Corporation98
Python new feature: Propagation
§ Constraint propagation is the process of communicating the domain reduction of a decision variable to all of the constraints that are stated over this variable.
§ Result is a partial solution with a reduced domain for each variable.
from docplex.cp.model import CpoModel
# Create modelmdl = CpoModel()
# Create an array of variables for positions of ruler marksORDER = 6marks = mdl.integer_var_list(ORDER, 0, (ORDER - 1) ** 2, "M")
# Force all marks distances to be differentmdl.add(mdl.all_diff([marks[i] - marks[j] for i in range(1, ORDER) for j in range(0, i)]))
# Avoid symmetric and mirror solutionsfor i in range(1, ORDER):
mdl.add(marks[i] > marks[i - 1])mdl.add((marks[1] - marks[0]) < (marks[ORDER - 1] - marks[ORDER - 2]))
# Minimize ruler size (position of the last mark)mdl.add(mdl.minimize(marks[ORDER - 1]))
# Propagate constraintsmsol = mdl.propagate()print("Solution: " + ' '.join(str(msol[v]) for v in marks))
> python golomb_ruler.pySolution: ((0, 20),) ((1, 21),) ((2, 22),) ((3, 23),) ((4, 24),) ((5, 25),)
© 2016 IBM Corporation99
Python new feature: Conflict refiner
§ The conflict refiner is used to find an explanation for the infeasibility of a model.§ Result is a list of constraints and/or variable that are a primer failing cause.
from docplex.cp.model import CpoModel
# Create modelmdl = CpoModel()
# Create an array of variables for positions of ruler marksORDER = 4 # Number of marksMAX_LENGTH = 4 # Max rule length, voluntarily TOO SHORT to have an infeasible modelmarks = mdl.integer_var_list(ORDER, 0, MAX_LENGTH, "M")
# Force all marks distances to be differentmdl.add(mdl.all_diff([marks[i] - marks[j] for i in range(1, ORDER) for j in range(0, i)]))
# Avoid symmetric and mirror solutionsfor i in range(1, ORDER):
mdl.add(marks[i] > marks[i - 1])mdl.add((marks[1] - marks[0]) < (marks[ORDER - 1] - marks[ORDER - 2]))
# Minimize ruler size (position of the last mark)mdl.add(mdl.minimize(marks[ORDER - 1]))
# Call conflict refiner to identify failing causesrsol = mdl.refine_conflict()rsol.print_conflict()
> python golomb_ruler.pyConflict refiner result:Member constraints:
_CTR_3 = M2 > M1_CTR_2 = M1 > M0_CTR_1 = alldiff([M1 - M0, M2 - M0, M2 - M1, M3 - M0, M3 - M1, M3 - M2])_CTR_4 = M3 > M2
© 2016 IBM Corporation100
Python new feature: Solution iteration
from docplex.cp.model import CpoModelfrom docplex.cp.solver.solver import CpoSolver
# Create model. . . . . (see above) . . . . .
# Minimize ruler size (position of the last mark)minexpr = mdl.minimize(marks[ORDER - 1])mdl.add(minexpr)
# First solve the model to find the smallest ruler lengthmsol = mdl.solve()rsize = msol[marks[ORDER - 1]]print("Shortest ruler for order {} has length {}".format(ORDER, rsize))
# Update the model to remove minimization and force last mark positionmdl.remove(minexpr)mdl.add(marks[ORDER - 1] == rsize)
# Request all solutionsprint("List of all possible rulers:")for msol in CpoSolver(mdl, SearchType='DepthFirst', Workers=1):
print(' '.join(str(msol[v]) for v in marks))
> python golomb_ruler.pyShortest ruler for order 6 has length 17List of all possible rulers for length 17:0 1 4 10 12 170 1 8 11 13 170 1 8 12 14 170 1 4 10 15 17
§ With our Golomb ruler example, suppose we would like to retrieve ALL possible rulers that have a minimal length.
§ We first solve the initial model to get the minimal ruler size, force the last mark to this size, and then iterate on all solutions :
© 2016 IBM Corporation101
Python new feature: Warm start
§ Warm start allows to initialize the solver with a partial solution that can speed-up the search of the solution.
§ This function is available when solving locally or with DOcloud.
from docplex.cp.model import CpoModelfrom docplex.cp.solution import CpoModelSolution
# Create model. . . . . (as above) . . . . .
# Add starting pointsp = CpoModelSolution()sp.add_integer_var_solution(marks[1], 1)sp.add_integer_var_solution(marks[2], 4)mdl.set_starting_point(sp)
# Solve modelmsol = mdl.solve()print("Solution: " + ' '.join(str(msol[v]) for v in marks))
> python golomb_ruler.pySolution: 0 1 4 10 12 17
© 2016 IBM Corporation102
V12.5.1 06/2013
V12.6 10/2013
V12.6.1 9/2014
V12.6.2 5/2015
V12.6.3 11/2015
V12.7 10/2016
0%10%20%30%40%50%60%70%
Progress factor between CP Optimizer releases
Integer
Scheduling
© 2016 IBM Corporation104
Legal Disclaimer
• © IBM Corporation 2015. All Rights Reserved.• The information contained in this publication is provided for informational purposes only. While efforts were made to verify
the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.
• References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results.
• Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.
• IBM, the IBM logo, CPLEX Optimizer, CPLEX Optimization Studio are trademarks of International Business Machines Corporation in the United States, other countries, or both. Unyte is a trademark of WebDialogs, Inc., in the United States,other countries, or both.
• If you reference Intel® and/or any of the following Intel products in the text, please mark the first use and include those thatyou use as follows; otherwise delete:Intel, Intel Centrino, Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.