Download presentation

Presentation is loading. Please wait.

Published byRenee Horlick Modified over 2 years ago

1
Copyright © ILOG 2008 IBM ILOG CPLEX Advanced Performance Tuning Optimization Technologies Workshop John Gregory CPLEX Product Manager IBM

2
2 Copyright © ILOG 2008 CPLEX Performance Tuning Overview Speed Continuous Models (LP, QP, QCP/SOCP) MIP Memory Operating System Deployment Application CPLEX Numerical Ill conditioning Numerical Instability Summary

3
3 Copyright © ILOG 2008 Tuning for Speed: Continuous Models Try each algorithm Primal Simplex Dual Simplex Network Simplex Barrier (only option for QCP/SOCP) Sifting (LP only) Concurrentopt (LP only, parallel processors)

4
4 Copyright © ILOG 2008 Tuning for Speed: Continuous Models Other tactics Presolve dual on (apply presolve, then solve the dual model) LP only Constraints : [Greater: ] Variables : [Free: ] Constraint nonzeros: Objective nonzeros: RHS nonzeros: Parallel barrier method Check for numerical difficulties

5
5 Copyright © ILOG 2008 Tuning for Speed: Continuous Models Iteration logs Degeneracy (simplex methods) Excessive time per iteration

6
6 Copyright © ILOG 2008 Tuning for Speed : Continuous Models Degeneracy, sample log Iter: 4751 Infeasibility = Iter: 4870 Infeasibility = Iter: 4976 Infeasibility = Iter: 5083 Infeasibility = Iter: 5191 Infeasibility = Iter: 5862 Infeasibility = Iter: 5968 Infeasibility = Perturbation started.

7
7 Copyright © ILOG 2008 Tuning for Speed: Continuous Models Excessive time per iteration, sample log Elapsed time = sec. (37000 iterations) Iter: Infeasibility = Iter: Infeasibility = Iter: Infeasibility = Elapsed time = sec. (41000 iterations)... Elapsed time = sec. ( iterations) Iter: Infeasibility = Elapsed time = sec. ( iterations) Elapsed time = sec. ( iterations) 12 sec. 827 sec.

8
8 Copyright © ILOG 2008 Tuning for Speed: Continuous Models Degeneracy Try each algorithm Instruct CPLEX to perturb the model Excessive time per iteration Try each algorithm Check for virtual memory usage Run with more memory available Turn on memory emphasis parameter Consider alternate pricing (pgradient/dgradient) Time per iteration depends on pricing scheme

9
9 Copyright © ILOG 2008 Tuning for Speed: MIP Try the Tuning Tool (CPLEX 11 or later) Primarily for MIPs, but works for all problem types Works with all CPLEX interfaces, including interactive optimizer Can make use of internal algorithm information Let CPLEX and your computer do the work

10
10 Copyright © ILOG 2008 Tuning for Speed: MIP Input: Model(s) to tune, tuning instructions Problem in memory or set of problems in files Fixed parameter set, parameters which should not be tuned, e.g., tolerances, threads Parameters, metrics to control tuning process (e.g. total tuning time, average or worst case run time) Output: Tuned and fixed parameter settings

11
11 Copyright © ILOG 2008 Tuning for Speed: MIP Examine node log (if Tuning Tool doesnt help) Excessive iteration counts for node relaxations. Use different start/sub algorithm. Barrier method doesnt support restarts. Set dual gradient to exact steepest edge norms, file parameter to store node file on disk and compress it. More progress needed in best integer or best node value?

12
12 Copyright © ILOG 2008 Nodes Cuts/ Node Left Objective IInf Best Integer Best Node ItCnt Fract: infeasible infeasible … infeasible … Solution time = sec. Iterations = Nodes = 10 (1) Tuning for Speed: MIP Excessive iteration counts for node LPs, sample node log #1 (dual simplex to solve node LPs)

13
13 Copyright © ILOG 2008 Tuning for Speed: MIP Excessive iteration counts for node LPs, sample node log #2 (primal simplex to solve node LPs) Nodes Cuts/ Node Left Objective IInf Best Integer Best Node ItCnt Fract: infeasible infeasible … infeasible … Solution time = sec. Iterations = Nodes = 10 (1)

14
14 Copyright © ILOG 2008 Tuning for Speed: MIP Progress in best node but not best integer: Nodes Cuts/ Node Left Objective IInf Best Integer Best Node ItCnt Gap % cutoff % % % % %

15
15 Copyright © ILOG 2008 Tuning for Speed: MIP Progress in best integer but not best node: Nodes Cuts/ Node Left Objective IInf Best Integer Best Node ItCnt Gap … % * % * % % %... * % % % %

16
16 Copyright © ILOG 2008 Tuning for Speed: MIP Tactics for lack of progress in best integer Use especially if customer accepts a good, perhaps sub optimal solution. MIP emphasis Set to 1 (emphasize integer feasibility) Set to 4 (emphasize finding hidden integer solutions) Solution Polishing Requires an integer feasible solution Use to improve sub optimal solutions at end of MIP search Or use as replacement for majority of MIP search when - local search works well - node LPs are time consuming - improving best node appears hopeless

17
17 Copyright © ILOG 2008 Tuning for Speed: MIP Lack of progress in best integer (continued) RINS Heuristic Local search heuristic - Needs an integer feasible solution MIP Starts and Solution Repair CPLEX 10.0 and later accepts partial MIP starts - Solution repair for (partial) infeasible MIP starts May make RINS, Solution Polishing more effective Feasibility Pump Heuristic (CPLEX 11 and later) Applied first at root node

18
18 Copyright © ILOG 2008 Tuning for Speed: MIP Lack of progress in best integer (continued) Probing Set to 3 (maximum probing) Cuts Set to 2 (aggressive cut generation) Cuts and Probing dont explicitly help find feasible solutions, but the resulting tighter formulation may help. Can be useful when combined with setting MIP emphasis to 1 (emphasize integer feasibility)

19
19 Copyright © ILOG 2008 Tuning for Speed: MIP Tactics for lack of progress in best node MIP emphasis Set to 2 or 3 to emphasize proving optimality and moving best node respectively. - May need Partial/Infeasible MIP start, Feasibility Pump or RINS Heuristic to compensate for fewer integer feasible solutions Probing Set to 3 (maximum probing) Cuts Set to 2 (aggressive cut generation) Cuts and Probing often tighten the model formulation

20
20 Copyright © ILOG 2008 Tuning for Speed: MIP Tactics for lack of progress in best node and best integer Set MIP emphasis to 3 May cause difficulties finding integer feasible solutions Compensate by using (partial or infeasible) MIP starts, Feasibility Pump, RINS Heuristic, Solution Polishing to help find more integer feasible solutions

21
21 Copyright © ILOG 2008 Tuning for Speed: MIP Tactics for lack of progress in best node and best integer (continued) Provide a starting solution, regardless of objective value Can help CPLEXs local search heuristics Can yield additional tightening of the model Consider external methods (e.g. Constraint Programming, Metaheuristics like Simulated Annealing, model specific heuristics) to find a starting solution Try CPLEXs feasopt feature

22
22 Copyright © ILOG 2008 Tuning for Speed: MIP Other tactics Specific model knowledge determines parameter settings Try branching up first

23
23 Copyright © ILOG 2008 Tuning for Speed: MIP Other tactics (continued) Specific model knowledge determines priority order. Time period models - Higher priority to earlier time periods. Dependencies among integer variables

24
24 Copyright © ILOG 2008 Tuning for Speed: MIP Other tactics (continued) Specific model knowledge determines changes to model Adding model specific cuts - Tighten formulation - Remove symmetry Sherali, Smith Improving Zero-One Model Representations Via Symmetry Considerations Model reformulation

25
25 Copyright © ILOG 2008 Memory Tuning: Operating System Virtual memory slows performance Task Manager (Windows) Top, ps, vmstat under Unix Make sure you can allocate all available memory Java VM limitations Use –Xmx option to increase heap size On a 32-bit machine, the real limit is 2GB Limits on individual accounts Compiler/Linker options 32 bit AIX has default of 256 MB for memory allocations. Write a simple program to test available memory (or ask us for one).

26
26 Copyright © ILOG 2008 Memory Tuning: Deployment Considerations Compare memory usage Solve the Deployment application model(s) with: Interactive CPLEX Simple example programs Purify, Insure, Bounds Checker, Valgrind (Linux only) can help with memory leaks Make sure you solve the correct model Display problem statistics Data check parameter Diagnostic routines in check.c

27
27 Copyright © ILOG 2008 Memory Tuning: CPLEX Considerations Sometimes CPLEX really uses all available memory Default settings emphasize speed over memory conservation. Is CPLEX memory usage reasonable? 1 GB per million constraints of an LP - Exceptions: large aspect ratios, very dense constraints 1 GB per million (constraints + quadratic variables) of a QP - Exception: dense Q matrix lacking sparse factorization At least that much for MIP, MIQP

28
28 Copyright © ILOG 2008 Memory Tuning: CPLEX Considerations Memory conservation techniques General Turn memory emphasis on (slight extra run time) Use different algorithm (LP and QP) As a last resort, turn presolve off (potential big increase in run time) LP Set presolve dual indicator on

29
29 Copyright © ILOG 2008 Memory Tuning: CPLEX Considerations Memory conservation techniques (continued) MIP MIP search tree often dominates memory usage - Performance tuning to reduce node count. - Setting node file parameter to 3 efficiently writes nodes to disk. - Setting variable select parameter to 3 (strong branching). Fewer nodes required to make the same amount of progress.

30
30 Copyright © ILOG 2008 Memory Tuning: Other Tactics Buy more memory (but only after accurately estimating requirements) Specialized algorithms Example: Column generation for models with large aspect ratios.

31
31 Copyright © ILOG 2008 Memory Tuning: Other Tactics Review of model development process Model reformulation Reduce problem dimensions Reduce difficulty while increasing problem size. MIP reformulations for column generation. Increase in problem size in exchange for sparser problem data

32
32 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Sensitivity of computed solutions to perturbations in problem data Condition number of a matrix CPLEX solves systems of equations of the form Exact solution is

33
33 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Condition number of a matrix (continued) To measure effects of perturbations, consider Exact solution is Combine with exact solution of x:

34
34 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Condition number of a matrix (ctd). Using Cauchy - Schwarz inequality This gives max. absolute change in x relative to change in b. Now consider relative change by using Cauchy - Schwarz inequality in original system:

35
35 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Condition number of a matrix (continued) Combine and rearrange to get Similar procedure for perturbing B yields

36
36 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Ill conditioning can occur under perfect arithmetic But, finite precision can perturb the exact system of equations we wish to solve, resulting in significant changes to the computed solution

37
37 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Sources of perturbations due to finite precision Rounding of data Near singular matrices Avoid computing data in single precision Round off error in the simplex method computations, particularly the basis factorization. Round off error due to scaling of large data values Floating point calculations involving values of greatly different orders of magnitude Avoid mixtures of very large and small coefficients

38
38 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Rounding of data Maximize x1 + x2 c1: 1/3 x1 + 2/3 x2= 1 c2: x1 + 2 x2 = 3 Solution: x1 = 3.0 Maximize x1 + x2 c1: x x2 = 1 c2: x1 + 2 x2 = 3 Solution: x1 = x2 = 1.0, cond(B) = e+06 Maximize x1 + x2 c1: x x2 = 1 c2: x1 + 2 x2 = 3 Solution: x1 = 3.0, cond(B) =

39
39 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Avoid rounding whenever possible Exact formulation: Maximize x1 + x2 c1: 1/3 x1 + 2/3 x2= 1 c2: x1 + 2 x2 = 3 Imprecisely rounded: Maximize x1 + x2 c1: x x2 = 1 c2: x1 + 2 x2 = 3 Scale to integral value whenever possible: Maximize x1 + x2 c1: x1 + 2 x2 = 3 c2: x1 + 2 x2 = 3

40
40 Copyright © ILOG 2008 Numerical Tuning: Ill conditioning Rounding of data (continued) Changes in right hand side can have similar effect Maximize x1 + x2 c1: x x2 = 1 c2: x1 + 2 x2 = 3 Solution: x1 = x2 = 1.0 Maximize x1 + x2 c1: x x2 = c2: x1 + 2 x2 = 3 Solution: x1 = 3.0

41
41 Copyright © ILOG 2008 Numerical Tuning: Numerical Instability Large values in problem data Bounds can magnify round off error: Large coefficient ratios in matrix rows or columns:

42
42 Copyright © ILOG 2008 Symptoms of Numerical Instability Sample iteration log Iter: 6389 Objective = Iter: 6390 Objective = Iter: 6391 Objective = Markowitz threshold set to 0.3. Iter: 6456 Scaled infeas = Iter: 6752 Scaled infeas = Iter: 6754 Objective =

43
43 Copyright © ILOG 2008 Numerical Tuning Tactics General Turn numerical emphasis on Rounding of data Compute data as accurately as possible Round off error in simplex method Set Markowitz tolerance to.90 (or higher if necessary) Large values in problem data Reduce large coefficients if possible Set scaling parameter to 1 (aggressive scaling)

44
44 Copyright © ILOG 2008 CPLEX Performance Tuning Summary CPLEX solves most problems with no trouble Organized tactics for the outliers can yield dramatic savings in time. Different categories of performance problems. Use all available information Iteration and node logs for LP and MIP Interactive CPLEX Simple test programs (CPLEX and your own) OS memory management tools Purify/Insure/Bounds Checker/Valgrind ILOG Technical Support and Consulting

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google