IBM ILOG CPLEX Optimization Studio CPLEXUser’sManual

3y ago
26 Views
2 Downloads
3.26 MB
564 Pages
Last View : 25d ago
Last Download : 3m ago
Upload by : Oscar Steel
Transcription

IBM ILOG CPLEX Optimization StudioCPLEX User’s ManualVersion 12 Release 6

IBM ILOG CPLEX Optimization StudioCPLEX User’s ManualVersion 12 Release 6

Copyright noticeDescribes general use restrictions and trademarks related to this document and the software described in this document. Copyright IBM Corp. 1987, 2015US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract withIBM Corp.TrademarksIBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp.,registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or othercompanies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" atwww.ibm.com/legal/copytrade.shtml.Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of AdobeSystems Incorporated in the United States, and/or other countries.Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.UNIX is a registered trademark of The Open Group in the United States and other countries.Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States,other countries, or both.Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.Other company, product, or service names may be trademarks or service marks of others.Additional registered trademarks, copyrights, licensesIBM ILOG CPLEX states these additional registered trademarks, copyrights, and acknowledgements.Python is a registered trademark of the Python Software Foundation.MATLAB is a registered trademark of The MathWorks, Inc.OpenMPI is distributed by The Open MPI Project under the New BSD license and copyright 2004 - 2012.MPICH2 is copyright 2002 by the University of Chicago and Argonne National Laboratory. Copyright IBM Corporation 1987, 2015.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

ContentsMeet CPLEX . . . . . . . . . . . . xiiiWhat is CPLEX? . . . . . . . . . . . . xiiiWhat does CPLEX do? . . . . . . . . . . xiiiWhat you need to know . . . . . . . . . . xvExamples online. . . . . . . . . . . . . xvNotation in this manual . . . . . . . . . . xviiRelated documentation . . . . . . . . . . xviiiOnline services . . . . . . . . . . . . . xxFurther reading . . . . . . . . . . . . . xxPart 1. Languages and APIs . . . . . 1Chapter 1. Concert Technology for C users . . . . . . . . . . . . . . . . 3Overview . . . . . . . . . . . . . . . 3Architecture of a CPLEX C application . . . . . 3Compiling and linking . . . . . . . . . . . 4Creating a C application with Concert Technology 4Modeling an optimization problem with ConcertTechnology . . . . . . . . . . . . . . . 5Overview . . . . . . . . . . . . . . 5Creating the environment: IloEnv . . . . . . 5Defining variables and expressions: IloNumVar . . 6Declaring the objective: IloObjective . . . . . 7Adding constraints: IloConstraint and IloRange. . 7Formulating a problem: IloModel . . . . . . 7Managing data . . . . . . . . . . . . 8Solving the model . . . . . . . . . . . . 9Overview . . . . . . . . . . . . . . 9Extracting a model . . . . . . . . . . . 10Invoking a solver . . . . . . . . . . . 11Choosing an optimizer. . . . . . . . . . 11Controlling the optimizers . . . . . . . . 13Accessing solution information . . . . . . . . 14Accessing solution status . . . . . . . . . 14Querying solution data . . . . . . . . . 15Accessing basis information . . . . . . . . 16Performing sensitivity analysis . . . . . . . 16Analyzing infeasible problems . . . . . . . 16Assessing solution quality . . . . . . . . 17Modifying a model . . . . . . . . . . . . 17Overview . . . . . . . . . . . . . . 18Deleting and removing modeling objects . . . 18Changing variable type . . . . . . . . . 19Handling errors . . . . . . . . . . . . . 20Example: optimizing the diet problem in C . . . 21Overview . . . . . . . . . . . . . . 21Problem representation . . . . . . . . . 21Application description . . . . . . . . . 23Creating multi-dimensional arrays with IloArray 23Using arrays for input or output . . . . . . 23Solving the model with IloCplex . . . . . . 25Complete program . . . . . . . . . . . 26 Copyright IBM Corp. 1987, 2015Chapter 2. Concert Technology forJava users . . . . . . . . . . . . . 27Architecture of a CPLEX Java application . . . .Overview . . . . . . . . . . . . . .Compiling and linking a Java application . . .Creating a Java application with Concert TechnologyModeling an optimization problem with ConcertTechnology in the Java API . . . . . . . . .Overview . . . . . . . . . . . . . .Using IloModeler . . . . . . . . . . .The active model . . . . . . . . . . .Building the model . . . . . . . . . . .Solving the model . . . . . . . . . . . .Accessing solution information . . . . . . . .Choosing an optimizer . . . . . . . . . .Overview . . . . . . . . . . . . . .What does CPLEX solve? . . . . . . . . .Solving a single continuous model. . . . . .Solving subsequent continuous relaxations in aMIP . . . . . . . . . . . . . . . .Controlling CPLEX optimizers . . . . . . . .Overview . . . . . . . . . . . . . .Parameters . . . . . . . . . . . . .Priority orders and branching directions . . . .More solution information . . . . . . . . .Overview . . . . . . . . . . . . . .Writing solution files . . . . . . . . . .Dual solution information . . . . . . . .Basis information . . . . . . . . . . .Infeasible solution information . . . . . . .Solution quality . . . . . . . . . . . .Advanced modeling with IloLPMatrix . . . . .Modeling by column . . . . . . . . . . .What is modeling by column? . . . . . . .Procedure for Modeling by Column . . . . .Example: optimizing the diet problem in Java . . .Modifying the model . . . . . . . . . . 24243434444454547Chapter 3. Concert Technology for.NET users . . . . . . . . . . . . . 49Prerequisites . . . . . . . . . . . .Describe . . . . . . . . . . . . .Step 1: Describe the problem . . . . . .Step 2: Open the file . . . . . . . . .Model . . . . . . . . . . . . . .Step 3: Create the model . . . . . . . .Step 4: Create an array to store the variables .Step 5: Specify by row or by column . . . .Build by Rows . . . . . . . . . . .Step 6: Set up rows . . . . . . . . . .Step 7: Create the variables: build and populaterows. . . . . . . . . . . . . . .Step 8: Add objective . . . . . . . . .Step 9: Add nutritional constraints. . . . .Build by Columns . . . . . . . . . .by.49495050515151525252.52525353iii

Step 10: Set up columns . . . . . . . . .Step 11: Add empty objective function andconstraints. . . . . . . . . . . . . .Step 12: Create variables . . . . . . . . .Solve . . . . . . . . . . . . . . .Step 13: Solve . . . . . . . . . . . .Step 14: Display the solution . . . . . . .Step 15: End application . . . . . . . . .Good programming practices . . . . . . .Step 16: Read the command line (data from user).Step 17: Show correct use of command line . . .Step 18: Enclose the application in try catchstatements . . . . . . . . . . . . . .Example: optimizing the diet problem in C#.NET.Example: copying a model . . . . . . . . 53.535454545455555555. 56. 56. 56Chapter 4. Callable Library . . . . . . 59Architecture of the Callable Library . . . .Overview . . . . . . . . . . . .Compiling and linking . . . . . . .Using the Callable Library in an application .Overview . . . . . . . . . . . .Initialize the CPLEX environment . . . .Instantiate the problem as an object . . .Put data in the problem object . . . . .Optimize the problem . . . . . . . .Change the problem object . . . . . .Destroy the problem object . . . . . .Release the CPLEX environment . . . .CPLEX programming practices . . . . . .Overview . . . . . . . . . . . .Variable names and calling conventions . .Data types. . . . . . . . . . . .Ownership of problem data . . . . . .Problem size and memory allocation issues .Status and return values . . . . . . .Symbolic constants . . . . . . . . .Parameter routines . . . . . . . . .Null arguments . . . . . . . . . .Row and column references . . . . . .Character strings . . . . . . . . .Checking and debugging problem data . .Callbacks . . . . . . . . . . . .Portability . . . . . . . . . . . .FORTRAN interface . . . . . . . .C interface . . . . . . . . . . .Managing parameters from the Callable LibraryExample: optimizing the diet problem in theCallable Library . . . . . . . . . . .Overview . . . . . . . . . . . .Problem representation . . . . . . .Program description . . . . . . . .Solving the model with CPXlpopt . . . .Complete program . . . . . . . . .Using surplus arguments for array allocations .Example: using query routines lpex7.c . . 76869707171.7273737475757577Chapter 5. CPLEX for Python users . . 79Why Python? . . . .Meet the Python API .ivCPLEX User’s Manual. 79. 80Modifying and querying problem data in thePython API . . . . . . . . . . . . .Using polymorphism in the Python API . . . .Example: generating a histogram . . . . . .Querying solution information in the Python APIExamining variables with nonzero values in asolution . . . . . . . . . . . . . .Displaying high precision nonzero values of asolution . . . . . . . . . . . . . .Managing CPLEX parameters in the Python API .Using callbacks in the Python API . . . . . .Example: displaying solutions with increasedprecision from the Python API . . . . . . .Example: examining the simplex tableau in thePython API . . . . . . . . . . . . .Example: solving a sequence of related problems inthe Python API . . . . . . . . . . . .Example: complex termination criteria in a callback.80808182. 83. 83. 84. 84. 85. 86. 8686Part 2.Programming considerations . . . 89Chapter 6. Developing CPLEXapplications . . . . . . . . . . . . 91Tips for successful application development . .Prototype the model . . . . . . . . .Identify routines to use . . . . . . . .Test interactively . . . . . . . . . .Assemble data efficiently . . . . . . . .Test data . . . . . . . . . . . . .Test and debug the model . . . . . . .Choose an optimizer . . . . . . . . .Program with a view toward maintenance andmodifications . . . . . . . . . . . .Using the Interactive Optimizer for debugging .Eliminating common programming errors . . .Turn on the data check parameter . . . . .Check your include files . . . . . . . .Clean house and try again . . . . . . .Read your messages . . . . . . . . .Check return values . . . . . . . . .Beware of numbering conventions . . . . .Make local variables temporarily global . . .Solve the problem you intended . . . . .Special considerations for FORTRAN . . . .Tell us . . . . . . . . . . . . . r 7. Managing input and output 101Platform limits on files . . .Representing very large models:Selecting an encoding . . .Understanding file formats . .Overview. . . . . . .Working with LP files . .Working with MPS files . .Converting file formats . .Using Concert XML extensionsUsing Concert csvReader . .Managing log files . . . . . . . .64-bit API. . . . . . . . . . . . . . . . . . . . . . . . . . . .101101106107107107108109110111111

Overview . . . . . . . . . . . . .Creating, renaming, relocating log files . . .Closing log files . . . . . . . . . .Controlling message channels . . . . . . .Overview. . . . . . . . . . . . .Output channels in the Interactive OptimizerCallable Library routines for message channelsExample: Callable Library message channels .Concert Technology message channels . . .111112112112112113114. 115. 116Chapter 8. Timing interface . . . . . 117Determinism and the timing interface .Using the timing interface . . . . .Using the timing interface in callbacks .Chapter 9. Tuning tool. 117. 118. 119. . . . . . . 121Meet the tuning tool . . . . . . . . . .Overview: scope of the tuning tool . . . .If CPLEX solves your problem to optimality .If CPLEX finds solutions but does not proveoptimality . . . . . . . . . . . .Tuning and time limits . . . . . . . .Tuning time limits and determinism . . . .Tuning results . . . . . . . . . . .Invoking the tuning tool. . . . . . . . .Examples: time limits on tuning in the InteractiveOptimizer . . . . . . . . . . . . .Fixing parameters and tuning multiple models inthe Interactive Optimizer . . . . . . . .Invoking the tuning tool in the InteractiveOptimizer . . . . . . . . . . . .Fixed parameters to respect . . . . . .Files of models to tune . . . . . . . .Tuning models in the Callable Library (C API) .Callbacks for tuning . . . . . . . . . .Terminating a tuning session . . . . . . .Part 3. Continuous optimization. 121. 121. 121.122122123124124. 125. 126.127127127128129129131Chapter 10. Solving LPs: simplexoptimizers . . . . . . . . . . . . . 133Introducing the primal and dual optimizers . .Choosing an optimizer for your LP problem . .Overview of LP optimizers . . . . . . .Automatic selection of an optimizer . . . .Dual simplex optimizer . . . . . . . .Primal simplex optimizer . . . . . . .Network optimizer . . . . . . . . .Barrier optimizer . . . . . . . . . .Sifting optimizer . . . . . . . . . .Concurrent optimizer. . . . . . . . .Parameter settings and optimizer choice . .Tuning LP performance . . . . . . . . .Introducing performance tuning for LP modelsPreprocessing . . . . . . . . . . .Starting from an advanced basis . . . . .Simplex parameters . . . . . . . . .Diagnosing performance problems . . . . .Lack of memory . . . . . . . . . 44144Ill conditioning . . . . . . . . . . . .Numeric difficulties . . . . . . . . . .Diagnosing LP infeasibility . . . . . . . . .Infeasibility reported by LP optimizers . . . .Coping with an ill-conditioned problem orhandling unscaled infeasibilities . . . . . .Interpreting solution quality . . . . . . .Finding a conflict . . . . . . . . . . .Repairing infeasibility: FeasOpt . . . . . .Examples: using a starting basis in LP optimizationOverview. . . . . . . . . . . . . .Example ilolpex6.cpp . . . . . . . . . .Example lpex6.c . . . . . . . . . . .145146150150151152155155155155155156Chapter 11. Solving LPs: barrieroptimizer . . . . . . . . . . . . . 157Introducing the barrier optimizer . . . . . . .Barrier simplex crossover . . . . . . . . .Differences between barrier and simplex optimizersUsing the barrier optimizer. . . . . . . . .Special options in the Interactive Optimizer . . .Controlling crossover . . . . . . . . . . .Using SOL file format . . . . . . . . . .Interpreting the barrier log file . . . . . . .Accessing and managing the log file of thebarrier optimizer . . . . . . . . . . .Sample log file from the barrier optimizer . . .Sample log file from the augmented systemsolver . . . . . . . . . . . . . . .Preprocessing in the log file . . . . . . .Nonzeros in lower triangle of A*A' in the logfile . . . . . . . . . . . . . . . .Ordering-algorithm time in the log file . . . .Cholesky factor in the log file . . . . . . .Iteration progress in the log file . . . . . .Infeasibility ratio in the log file . . . . . .Understanding solution quality from the barrier LPoptimizer . . . . . . . . . . . . . . .Tuning barrier optimizer performance . . . . .Overview of parameters for tuning the barrieroptimizer . . . . . . . . . . . . . .Memory emphasis: letting the optimizer usedisk for storage. . . . . . . . . . . .Preprocessing . . . . . . . . . . . .Detecting and eliminating dense columns . . .Choosing an ordering algorithm . . . . . .Using a starting-point heuristic . . . . . .Overcoming numeric difficulties . . . . . . .Default behavior of the barrier optimizer withrespect to numeric difficulty . . . . . . .Numerical emphasis settings . . . . . . .Difficulties in the quality of solution. . . . .Difficulties during optimization . . . . . .Difficulties with unbounded problems . . . .Diagnosing infeasibility reported by barrieroptimizer . . . . . . . . . . . . . . pter 12. Solving network-flowproblems . . . . . . . . . . . . . 177Choosing an optimizer: network considerationsContents177v

Formulating a network problem . . . . . .Example: network optimizer in the InteractiveOptimizer . . . . . . . . . . . . .Network flow problem description . . . .Understanding the network log file . . . .Tuning performance of the network optimizerSolving problems with the network optimizer .Invoking the network optimizer . . . . .Network extraction . . . . . . . . .Preprocessing and the network optimizer . .Example: using the network optimizer with theCallable Library netex1.c . . . . . . . .Solving network-flow problems as LP problemsExample: network to LP transformation netex2.c. 177. 178. 178. 179180. 180. 180. 181. 181. 181183184Chapter 13. Solving problems with aquadratic objective (QP) . . . . . . 185Distinguishing between convex and nonconvexQPs . . . . . . . . . . . . . .Entering QPs . . . . . . . . . . .Matrix view . . . . . . . . . . .Algebraic view . . . . . . . . . .Examples for entering QPs . . . . . .Reformulating QPs to save memory . . .Saving QP problems . . . . . . . . .Changing problem type in QPs . . . . .Changing quadratic terms . . . . . . .Optimizing QPs . . . . . . . . . .Diagnosing QP infeasibility. . . . . . .Examples: creating a QP, optimizing, finding asolution . . . . . . . . . . . . .Problem description of a quadratic programExample: iloqpex1.cpp . . . . . . .Example: QPex1.java . . . . . . . .Example: qpex1.c . . . . . . . . .Example: reading a QP from a file qpex2.c 195Chapter 14. Solving problems withquadratic constraints (QCP) . . . . . 197Identifying a quadratically constrained program(QCP) . . . . . . . . . . . . . . .Characteristics of a quadratically constrainedprogram . . . . . . . . . . . . .Convexity . . . . . . . . . . . .Semi-definiteness . . . . . . . . . .Second order cone programming (SOCP) andnon PSD . . . . . . . . . . . . .Representing SOCP as Lagrangian . . . .Detecting the problem type of a QCP or SOCP .Overview. . . . . . . . . . . . .Concert Technology and QCP problem type .Callable Library and QCP problem type . .Interactive Optimizer and QCP problem typeFile formats and QCP problem type . . . .Changing problem type in a QCP . . . . .Changing quadratic constraints . . . . . .Solving with quadratic constraints . . . . .Numeric difficulties and quadratic constraints .Accessing dual values and reduced costs of QCPsolutions . . . . . . . . . . . . . .viCPLEX User’s Manual. 197. 197. 197. 199.199200202202202202203203206207208208. 208Accessing dual values andsolutions . . . . . .Examples: SOCP . . .Examples: QCP. . . .reduced. . . . . . .costs. . . .of.SOCP. . . 211. . . 213. . . 213Part 4. Discrete optimization . . . 215Chapter 15. Solving mixed integerprogramming problems (MIP) . . . . 217Stating a MIP problem . . . . . . . . . .Preliminary issues . . . . . . . . . . . .Entering MIP problems . . . . . . . . .Displaying MIP problems . . . . . . . .Changing problem type in MIPs . . . . . .Changing variable type . . . . . . . . .Using the mixed integer optimizer . . . . . .Invoking the optimizer for a MIP model. . . .Emphasizing feasibility and optimality . . . .Terminating MIP optimization . . . . . . .Tuning performance features of the mixed integeroptimizer . . . . . . . . . . . . . . .Branch & cut or dynamic search? . . . . .Introducing performance features of the MIPoptimiz

IBM ILOG CPLEX Optimization Studio CPLEXUser’sManual . optimization

Related Documents:

W HAT IS ILOG CPLEX? 12 ILOG CPLEX 8.1 — GETTING STARTED What Is ILOG CPLEX? ILOG CPLEX is a tool for solving linear optimization problems, commonly referred to as Linear Programming (LP) problems, of the form: where can be , , or , and the upper bounds ui and lower bounds li may be positive infinity, negative infinity, or any real .

the MATLAB environment. Cplex Class API Describes the Cplex class While the CPLEX for MATLAB Toolbox functions provide the ability to solve a multitude of mathematical programming problems, the toolbox design does not support restart. To enable users to use decomposition algorithms, the Cplex Class API is also provided in CPLEX for MATLAB.

CO N T E N T S ILOG CPLEX 10.0 — USER' S MANUAL 3 Table of Contents Preface Meet ILOG CPLEX .

Installing WebSphere Integration Developer with ILOG JRules Page : 9 Installing ILOG JRules In this section we will install a desktop edition of ILOG JRules. When installing JRules, you can choose to install either ILOG JRules tools for developers or an ILOG JRules Server.

Exploring IBM WebSphere ILOG JRules Integration with IBM WebSphere Process Server Page 4 Figure 1: BPM Integration with IBM WebSphere ILOG JRules While the orientations of the technologies may be orthogonal, they depend upon a contractual relationship that is typical in an SOA. For example, in the case of SOAP, the service signature is defined .

ILOG JRules Rule Studio provides a set of tools for IT development teams (i.e., programmers) that integrate as plug-ins into the Open Source Community's Eclipse, IBM's Rational Application Developer (RAD), and IBM's Rational Software Architect (RSA) IDEs. Rule Studio supports

IBM ILOG Script is different from OPL modeling language IBM ILOG Script is an implementation of JavaScript Includes extension classes for OPL using which Model elements can be accessed and modified in Flow Control All IBM ILOG Script extension classes for OPL start with Ilo, (for example IloOplModel, IloCplex, IloCP)

Automotive Skills Course Specification (C271 74) Valid from August 2013 This edition, October 2018, version 3.0 This specification may be reproduced in whole or in part for educational purposes provided that no profit is derived from reproduction and that, if reproduced in part, the source is acknowledged. Additional copies of this course specification can be downloaded from SQA’s website .