ps usrmancplex

952
IBM ILOG CPLEX V12.1 User's Manual for CPLEX © Copyright International Business Machines Corporation 1987, 2009 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Upload: neokratox

Post on 26-Nov-2015

204 views

Category:

Documents


3 download

DESCRIPTION

CPLEX CONVERT USER MANUAL

TRANSCRIPT

  • IBM ILOG CPLEX V12.1

    User's Manual for CPLEX

    Copyright International Business Machines Corporation 1987, 2009US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

  • Legal notices

    Copyright notice Copyright International Business Machines Corporation 1987, 2009.US Government Users Restricted Rights - Use, duplication or disclosure restricted byGSA ADP Schedule Contract with IBM Corp.

    TrademarksIBM, the IBM logo, ibm.com, WebSphere, ILOG, the ILOG design, and CPLEX aretrademarks or registered trademarks of International Business Machines Corp., registeredin many jurisdictions worldwide. Other product and service names might be trademarksof IBM or other companies. A current list of IBM trademarks is available on the Web at"Copyright and trademark information" at http://www.ibm.com/legal/copytrade.shtmlAdobe, the Adobe logo, PostScript, and the PostScript logo are either registeredtrademarks or trademarks of Adobe Systems Incorporated in the United States, and/orother countries.

    Linux is a registered trademark of Linus Torvalds in the United States, other countries,or both.Microsoft, Windows, Windows NT, and the Windows logo are trademarks of MicrosoftCorporation in the United States, other countries, or both.Java and all Java-based trademarks and logos are trademarks of Sun Microsystems,Inc. in the United States, other countries, or both.Other company, product, or service names may be trademarks or service marks of others.

    Further notices

    Additional registered trademarksPython is a registered trademark of the Python Software Foundation.MATLAB is a registered trademark of The MathWorks, Inc.

    Acknowledgement of use: dtoa routine of the gdtoa packageILOG acknowledges use of the dtoa routine of the gdtoa package, available athttp://www.netlib.org/fp/.

    The author of this software is David M. Gay.All Rights Reserved.

  • Copyright (C) 1998, 1999 by Lucent TechnologiesPermission to use, copy, modify, and distribute this software and its documentation forany purpose and without fee is hereby granted, provided that the above copyright noticeappears in all copies and that both that the copyright notice and this permission noticeand warranty disclaimer appear in supporting documentation, and that the name ofLucent or any of its entities not be used in advertising or publicity pertaining to distributionof the software without specific, written prior permission.LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. INNO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY SPECIAL,INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVERRESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTIONOF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OFOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.(end of license terms of dtoa routine of the gdtoa package)

  • Table of contents

    For technical support...............................................................................................23Contacting IBM Support...........................................................................................................24

    Meet CPLEX..............................................................................................................27What is CPLEX?........................................................................................................................28What does CPLEX do?..............................................................................................................29What you need to know............................................................................................................31Examples online........................................................................................................................32Notation in this manual.............................................................................................................35Related documentation.............................................................................................................36Online services..........................................................................................................................38Further reading..........................................................................................................................39

    Languages and APIs................................................................................................41Concert Technology for C++ users..........................................................................................43Overview.......................................................................................................................................................45Architecture of a CPLEX C++ application....................................................................................................46Licenses.......................................................................................................................................................47Compiling and linking...................................................................................................................................48Creating a C++ application with Concert Technology...................................................................................49Modeling an optimization problem with Concert Technology........................................................................51

    Copyright IBM Corp. 1987, 2009 5

    C O N T E N T S

  • Overview...........................................................................................................................................52Creating the environment: IloEnv......................................................................................................53Defining variables and expressions: IloNumVar................................................................................54Declaring the objective: IloObjective.................................................................................................56Adding constraints: IloConstraint and IloRange................................................................................57Formulating a problem: IloModel.......................................................................................................58Managing data..................................................................................................................................59

    Solving the model.........................................................................................................................................61Overview...........................................................................................................................................62Extracting a model............................................................................................................................64Invoking a solver...............................................................................................................................65Choosing an optimizer......................................................................................................................66Controlling the optimizers..................................................................................................................69

    Accessing solution information.....................................................................................................................71Accessing solution status..................................................................................................................72Querying solution data......................................................................................................................73Accessing basis information..............................................................................................................74Performing sensitivity analysis..........................................................................................................75Analyzing infeasible problems...........................................................................................................76Assessing solution quality.................................................................................................................77

    Modifying a model........................................................................................................................................79Overview...........................................................................................................................................80Deleting and removing modeling objects..........................................................................................81Changing variable type.....................................................................................................................82

    Handling errors.............................................................................................................................................83Example: optimizing the diet problem in C++...............................................................................................85

    Overview...........................................................................................................................................86Problem representation.....................................................................................................................87Application description......................................................................................................................89Creating multi-dimensional arrays with IloArray................................................................................90Using arrays for input or output.........................................................................................................91Solving the model with IloCplex........................................................................................................93Complete program............................................................................................................................94

    Concert Technology for Java users.........................................................................................95Architecture of a CPLEX Java application....................................................................................................97

    Overview...........................................................................................................................................98Licenses in a Java application.........................................................................................................100Compiling and linking a Java application........................................................................................101

    Creating a Java application with Concert Technology................................................................................102Modeling an optimization problem with Concert Technology in the Java API.............................................103

    Overview.........................................................................................................................................104Using IloModeler.............................................................................................................................107The active model.............................................................................................................................110

    U S E R ' S M A N U A L F O R C P L E X6

  • Building the model...........................................................................................................................111Solving the model.......................................................................................................................................113Accessing solution information...................................................................................................................115Choosing an optimizer................................................................................................................................117

    Overview.........................................................................................................................................118What does CPLEX solve?...............................................................................................................119Solving a single continuous model..................................................................................................121Solving subsequent continuous relaxations in a MIP......................................................................122

    Controlling CPLEX optimizers....................................................................................................................123Overview.........................................................................................................................................124Parameters......................................................................................................................................125Priority orders and branching directions.........................................................................................127

    More solution information...........................................................................................................................129Overview.........................................................................................................................................130Writing solution files........................................................................................................................131Dual solution information.................................................................................................................132Basis information.............................................................................................................................133Infeasible solution information.........................................................................................................134Solution quality................................................................................................................................135

    Advanced modeling with IloLPMatrix..........................................................................................................136Modeling by column....................................................................................................................................137

    What is modeling by column?.........................................................................................................138Procedure for Modeling by Column.................................................................................................139

    Example: optimizing the diet problem in Java.............................................................................................140Modifying the model...................................................................................................................................142Concert Technology for .NET users.......................................................................................143Prerequisites..............................................................................................................................................146Describe.....................................................................................................................................................147Step 1: Describe the problem.....................................................................................................................148Step 2: Open the file...................................................................................................................................149Model..........................................................................................................................................................150Step 3: Create the model............................................................................................................................151Step 4: Create an array to store the variables............................................................................................152Step 5: Specify by row or by column..........................................................................................................153Build by Rows.............................................................................................................................................154Step 6: Set up rows....................................................................................................................................155Step 7: Create the variables: build and populate by rows...........................................................................156Step 8: Add objective..................................................................................................................................157Step 9: Add nutritional constraints..............................................................................................................158Build by Columns........................................................................................................................................159Step 10: Set up columns............................................................................................................................160Step 11: Add empty objective function and constraints..............................................................................161Step 12: Create variables...........................................................................................................................162

    U S E R ' S M A N U A L F O R C P L E X 7

  • Solve...........................................................................................................................................................163Step 13: Solve............................................................................................................................................164Step 14: Display the solution......................................................................................................................165Step 15: End application and free license..................................................................................................166Good programming practices.....................................................................................................................167Step 16: Read the command line (data from user).....................................................................................168Step 17: Show correct use of command line..............................................................................................169Step 18: Enclose the application in try catch statements...........................................................................170Example: optimizing the diet problem in C#.NET.......................................................................................171Callable Library.......................................................................................................................173Architecture of the Callable Library............................................................................................................175

    Overview.........................................................................................................................................176Licenses..........................................................................................................................................177Compiling and linking......................................................................................................................178

    Using the Callable Library in an application...............................................................................................179Overview.........................................................................................................................................180Initialize the CPLEX environment....................................................................................................181Instantiate the problem as an object...............................................................................................182Put data in the problem object........................................................................................................183Optimize the problem......................................................................................................................184Change the problem object.............................................................................................................185Destroy the problem object.............................................................................................................186Release the CPLEX environment...................................................................................................187

    CPLEX programming practices..................................................................................................................189Overview.........................................................................................................................................191Variable names and calling conventions.........................................................................................192Data types.......................................................................................................................................194Ownership of problem data.............................................................................................................195Problem size and memory allocation issues...................................................................................196Status and return values.................................................................................................................197Symbolic constants.........................................................................................................................198Parameter routines..........................................................................................................................199Null arguments................................................................................................................................200Row and column references...........................................................................................................201Character strings.............................................................................................................................202Problem data...................................................................................................................................203Callbacks.........................................................................................................................................205Portability........................................................................................................................................206FORTRAN interface........................................................................................................................207C++ interface...................................................................................................................................209

    Managing parameters from the Callable Library........................................................................................210Example: optimizing the diet problem in the Callable Library.....................................................................213

    Overview.........................................................................................................................................214

    U S E R ' S M A N U A L F O R C P L E X8

  • Problem representation...................................................................................................................215Program description........................................................................................................................217Solving the model with CPXlpopt....................................................................................................218Complete program..........................................................................................................................219

    Using surplus arguments for array allocations...........................................................................................220Example: using query routines lpex7.c.......................................................................................................222

    Programming considerations................................................................................223Developing CPLEX applications............................................................................................225Tips for successful application development..............................................................................................227

    Prototype the model........................................................................................................................229Identify routines to use....................................................................................................................230Test interactively..............................................................................................................................231Assemble data efficiently................................................................................................................232Test data..........................................................................................................................................233Test and debug the model...............................................................................................................234Choose an optimizer.......................................................................................................................235Program with a view toward maintenance and modifications..........................................................236

    Using the Interactive Optimizer for debugging............................................................................................239Eliminating common programming errors...................................................................................................241

    Check your include files..................................................................................................................243Clean house and try again..............................................................................................................244Read your messages......................................................................................................................245Check return values........................................................................................................................246Beware of numbering conventions..................................................................................................247Make local variables temporarily global..........................................................................................248Solve the problem you intended......................................................................................................249Special considerations for FORTRAN.............................................................................................250Tell us..............................................................................................................................................251

    Managing input and output....................................................................................................253Overview.....................................................................................................................................................254Understanding file formats.........................................................................................................................255

    Overview.........................................................................................................................................256Working with LP files.......................................................................................................................257Working with MPS files...................................................................................................................259Converting file formats....................................................................................................................261

    Using Concert XML extensions..................................................................................................................262Using Concert csvReader..........................................................................................................................263Managing log files......................................................................................................................................265

    Overview.........................................................................................................................................266Creating, renaming, relocating log files...........................................................................................267Closing log files...............................................................................................................................268

    Controlling message channels...................................................................................................................269

    U S E R ' S M A N U A L F O R C P L E X 9

  • Overview.........................................................................................................................................270Parameter for output channels........................................................................................................271Callable Library routines for message channels.............................................................................272Example: Callable Library message channels................................................................................274Concert Technology message channels.........................................................................................275

    Timing interface.......................................................................................................................277Using the timing interface...........................................................................................................................278Licensing an application........................................................................................................281Overview.....................................................................................................................................................282Types of ILM runtime licenses....................................................................................................................283

    File-based RTNODE, RTSTOKEN or TOKEN keys........................................................................284Memory-based RUNTIME keys.......................................................................................................285

    Routines and methods for licensing...........................................................................................................286Examples....................................................................................................................................................287

    CPXputenv routine for C and C++ users.........................................................................................288The putenv method for Java users..................................................................................................289The Putenv method for .NET users.................................................................................................290CPXRegisterLicense routine for C and C++ users..........................................................................291The registerLicense method for Java users....................................................................................292The RegisterLicense method for .NET users..................................................................................293

    Summary....................................................................................................................................................294Tuning tool...............................................................................................................................295Meet the tuning tool....................................................................................................................................297

    Overview.........................................................................................................................................298If CPLEX solves your problem to optimality....................................................................................299If CPLEX finds solutions but does not prove optimality...................................................................300Tuning and time limits......................................................................................................................301Tuning results..................................................................................................................................302

    Invoking the tuning tool...............................................................................................................................303Example: time limits on tuning in the Interactive Optimizer........................................................................304Fixing parameters and tuning multiple models in the Interactive Optimizer...............................................305

    Invoking the tuning tool in the Interactive Optimizer........................................................................306Fixed parameters to respect...........................................................................................................307Files of models to tune....................................................................................................................308

    Tuning models in the Callable Library (C API)............................................................................................309Callbacks for tuning....................................................................................................................................310Terminating a tuning session......................................................................................................................311

    Continuous optimization.......................................................................................313Solving LPs: simplex optimizers...........................................................................................315Introducing the primal and dual optimizers.................................................................................................316Choosing an optimizer for your LP problem...............................................................................................317

    Overview of LP optimizers..............................................................................................................319

    U S E R ' S M A N U A L F O R C P L E X10

  • Automatic selection of an optimizer................................................................................................321Dual simplex optimizer....................................................................................................................322Primal simplex optimizer.................................................................................................................323Network optimizer...........................................................................................................................324Barrier optimizer..............................................................................................................................325Sifting optimizer...............................................................................................................................326Concurrent optimizer.......................................................................................................................327Parameter settings and optimizer choice........................................................................................328

    Tuning LP performance..............................................................................................................................329Introducing performance tuning for LP models...............................................................................330Preprocessing.................................................................................................................................331Starting from an advanced basis....................................................................................................334Simplex parameters........................................................................................................................336

    Diagnosing performance problems.............................................................................................................341Lack of memory..............................................................................................................................342Numeric difficulties..........................................................................................................................344

    Diagnosing LP infeasibility..........................................................................................................................349Infeasibility reported by LP optimizers............................................................................................350Coping with an ill-conditioned problem or handling unscaled infeasibilities....................................351Interpreting solution quality.............................................................................................................352Finding a conflict.............................................................................................................................355Repairing infeasibility: FeasOpt.......................................................................................................356

    Examples: using a starting basis in LP optimization...................................................................................357Overview.........................................................................................................................................358Example ilolpex6.cpp......................................................................................................................359Example lpex6.c..............................................................................................................................360

    Solving LPs: barrier optimizer...............................................................................................361Introducing the barrier optimizer.................................................................................................................363Barrier simplex crossover...........................................................................................................................365Differences between barrier and simplex optimizers..................................................................................366Using the barrier optimizer.........................................................................................................................367Special options in the Interactive Optimizer...............................................................................................368Controlling crossover..................................................................................................................................369Using SOL file format.................................................................................................................................370Interpreting the barrier log file....................................................................................................................371

    Accessing and managing the log file of the barrier optimizer..........................................................372Sample log file from the barrier optimizer.......................................................................................373Preprocessing in the log file............................................................................................................374Nonzeros in lower triangle of A*A' in the log file..............................................................................375Ordering-algorithm time in the log file.............................................................................................376Cholesky factor in the log file..........................................................................................................377Iteration progress in the log file.......................................................................................................378Infeasibility ratio in the log file.........................................................................................................379

    U S E R ' S M A N U A L F O R C P L E X 11

  • Understanding solution quality from the barrier LP optimizer.....................................................................380Tuning barrier optimizer performance.........................................................................................................383

    Overview of parameters for tuning the barrier optimizer.................................................................384Memory emphasis: letting the optimizer use disk for storage.........................................................386Preprocessing.................................................................................................................................387Detecting and eliminating dense columns.......................................................................................388Choosing an ordering algorithm......................................................................................................389Using a starting-point heuristic........................................................................................................390

    Overcoming numeric difficulties..................................................................................................................391Default behavior of the barrier optimizer with respect to numeric difficulty.....................................392Numerical emphasis settings..........................................................................................................393Difficulties in the quality of solution.................................................................................................394Difficulties during optimization........................................................................................................396Difficulties with unbounded problems..............................................................................................398

    Diagnosing infeasibility reported by barrier optimizer.................................................................................399Solving network-flow problems.............................................................................................401Choosing an optimizer: network considerations.........................................................................................402Formulating a network problem..................................................................................................................403Example: network optimizer in the Interactive Optimizer............................................................................405

    Network flow problem description...................................................................................................406Understanding the network log file..................................................................................................407Tuning performance of the network optimizer.................................................................................408

    Solving problems with the network optimizer.............................................................................................409Invoking the network optimizer........................................................................................................410Network extraction..........................................................................................................................411Preprocessing and the network optimizer.......................................................................................412

    Example: using the network optimizer with the Callable Library netex1.c..................................................413Solving network-flow problems as LP problems.........................................................................................415Example: network to LP transformation netex2.c.......................................................................................417Solving problems with a quadratic objective (QP)...............................................................419Identifying convex QPs...............................................................................................................................421Entering QPs..............................................................................................................................................423

    Matrix view......................................................................................................................................424Algebraic view.................................................................................................................................425Examples for entering QPs.............................................................................................................426Reformulating QPs to save memory...............................................................................................428

    Saving QP problems...................................................................................................................................429Changing problem type in QPs...................................................................................................................430Changing quadratic terms..........................................................................................................................431Optimizing QPs..........................................................................................................................................433Diagnosing QP infeasibility.........................................................................................................................434Examples: creating a QP, optimizing, finding a solution.............................................................................435

    Problem description of a quadratic program...................................................................................436

    U S E R ' S M A N U A L F O R C P L E X12

  • Example: iloqpex1.cpp....................................................................................................................437Example: QPex1.java......................................................................................................................438Example: qpex1.c............................................................................................................................439

    Example: reading a QP from a file qpex2.c................................................................................................440Solving problems with quadratic constraints (QCP)...........................................................441Identifying a quadratically constrained program (QCP)..............................................................................443

    Characteristics of a quadratically constrained program..................................................................444Convexity.........................................................................................................................................445Semi-definiteness............................................................................................................................447Second order cone programming (SOCP)......................................................................................448

    Detecting the problem type of a QCP or SOCP.........................................................................................449Overview.........................................................................................................................................450Concert Technology and QCP problem type...................................................................................451Callable Library and QCP problem type..........................................................................................452Interactive Optimizer and QCP problem type..................................................................................453File formats and QCP problem type................................................................................................454

    Changing problem type..............................................................................................................................459Changing quadratic constraints..................................................................................................................460Solving with quadratic constraints..............................................................................................................461Numeric difficulties and quadratic constraints............................................................................................462Examples: QCP..........................................................................................................................................463

    Discrete optimization.............................................................................................465Solving mixed integer programming problems (MIP)..........................................................467Stating a MIP problem................................................................................................................................469Preliminary issues......................................................................................................................................471

    Entering MIP problems....................................................................................................................472Displaying MIP problems.................................................................................................................473Changing problem type in MIPs......................................................................................................474Changing variable type...................................................................................................................476

    Using the mixed integer optimizer..............................................................................................................477Invoking the optimizer for a MIP model...........................................................................................478Emphasizing feasibility and optimality.............................................................................................479Terminating MIP optimization..........................................................................................................481

    Tuning performance features of the mixed integer optimizer......................................................................483Branch & cut or dynamic search?...................................................................................................485Introducing performance features of the MIP optimizer..................................................................486Applying cutoff values.....................................................................................................................487Applying tolerance parameters.......................................................................................................488Applying heuristics..........................................................................................................................489When an integer solution is found: the incumbent..........................................................................490Controlling strategies: diving and backtracking...............................................................................491Selecting nodes...............................................................................................................................492

    U S E R ' S M A N U A L F O R C P L E X 13

  • Selecting variables..........................................................................................................................493Changing branching direction.........................................................................................................494Solving subproblems.......................................................................................................................495Using node files...............................................................................................................................496Probing............................................................................................................................................497

    Cuts............................................................................................................................................................499What are cuts?................................................................................................................................501Clique cuts......................................................................................................................................502Cover cuts.......................................................................................................................................503Disjunctive cuts...............................................................................................................................504Flow cover cuts...............................................................................................................................505Flow path cuts.................................................................................................................................506Gomory fractional cuts....................................................................................................................507Generalized upper bound (GUB) cover cuts...................................................................................508Implied bound cuts..........................................................................................................................509Mixed integer rounding (MIR) cuts..................................................................................................510Multi-commodity flow (MCF) cuts....................................................................................................511Zero-half cuts..................................................................................................................................512Adding cuts and re-optimizing.........................................................................................................513Counting cuts..................................................................................................................................514Parameters affecting cuts................................................................................................................515

    Heuristics....................................................................................................................................................517What are heuristics?.......................................................................................................................518Node heuristic.................................................................................................................................519Relaxation induced neighborhood search (RINS) heuristic............................................................520Solution polishing............................................................................................................................521Feasibility pump..............................................................................................................................527

    Preprocessing: presolver and aggregator...................................................................................................528Starting from a solution: MIP starts............................................................................................................531Issuing priority orders.................................................................................................................................535Using the MIP solution...............................................................................................................................537Progress reports: interpreting the node log................................................................................................539Troubleshooting MIP performance problems..............................................................................................543

    Introducing trouble shooting for MIP performance..........................................................................545Too much time at node 0.................................................................................................................546Trouble finding more than one feasible solution..............................................................................547Large number of unhelpful cuts.......................................................................................................548Lack of movement in the best node................................................................................................549Time wasted on overly tight optimality criteria................................................................................550Slightly infeasible integer variables.................................................................................................551Running out of memory...................................................................................................................552Difficulty solving subproblems: overcoming degeneracy.................................................................556Unsatisfactory optimization of subproblems....................................................................................557

    U S E R ' S M A N U A L F O R C P L E X14

  • Examples: optimizing a simple MIP problem..............................................................................................561ilomipex1.cpp..................................................................................................................................562MIPex1.java.....................................................................................................................................563MIPex1.cs and MIPex1.vb...............................................................................................................564mipex1.c..........................................................................................................................................565

    Example: reading a MIP problem from a file...............................................................................................567ilomipex2.cpp..................................................................................................................................568mipex2.c..........................................................................................................................................569

    Solution pool: generating and keeping multiple solutions.................................................571What is the solution pool?..........................................................................................................................573Example: simple facility location problem...................................................................................................574Filling the solution pool...............................................................................................................................576Accumulating incumbents in the solution pool............................................................................................577Populating the solution pool.......................................................................................................................579

    What is populating the solution pool?.............................................................................................580Invoking the populate procedure.....................................................................................................581Algorithm of the populate procedure...............................................................................................582Example: calling populate...............................................................................................................583Stopping criteria for the populate procedure...................................................................................586Stored solutions, populate limit, and pool capacity.........................................................................588

    Choosing whether to accumulate or populate............................................................................................589Whats the difference between accumulating and populating?.......................................................590Advanced use: interaction of MIP optimization and populate..........................................................591Example: using populate after MIP optimization.............................................................................592

    Enumerating all solutions...........................................................................................................................593How to enumerate all solutions.......................................................................................................594Limitations due to continuous variables and finite precision...........................................................595Limitations due to unbounded MIP models.....................................................................................596Limitations due to numeric difficulties.............................................................................................597

    Impact of change on the solution pool........................................................................................................599Changes between MIP optimization and populate..........................................................................600Persistence of solutions in the solution pool...................................................................................601Model changes and the solution pool..............................................................................................602

    Examining the solution pool.......................................................................................................................603Accessing a solution in the solution pool....................................................................................................604Using solutions from the solution pool........................................................................................................606Deleting solutions from the solution pool....................................................................................................608The incumbent and the solution pool.........................................................................................................609Parameters of the solution pool..................................................................................................................611

    Which parameters control the solution pool?..................................................................................612Example: quality control through the solution pool gap parameter.................................................613Example: few or many solutions through intensity parameter.........................................................614Example: diverse solutions through replacement parameter..........................................................615

    U S E R ' S M A N U A L F O R C P L E X 15

  • Filtering the solution pool...........................................................................................................................617What are filters of the solution pool?...............................................................................................618Diversity filters.................................................................................................................................619Range filters....................................................................................................................................620Filter files.........................................................................................................................................621Example: controlling properties of solutions with filters...................................................................622Incumbent callback as a filter..........................................................................................................623

    Using special ordered sets (SOS)..........................................................................................625What is a special ordered set (SOS)?........................................................................................................626Example: SOS Type 1 for sizing a warehouse............................................................................................627Declaring SOS members............................................................................................................................628Example: using SOS and priority................................................................................................................629

    ilomipex3.cpp..................................................................................................................................630mipex3.c..........................................................................................................................................631

    Using semi-continuous variables: a rates example.............................................................633What are semi-continuous variables?........................................................................................................634Describing the problem..............................................................................................................................635Representing the problem..........................................................................................................................636Building a model.........................................................................................................................................637Solving the problem....................................................................................................................................638Ending the application................................................................................................................................639Complete program......................................................................................................................................640Using piecewise linear functions in optimization: a transport example............................641What is a piecewise linear function?..........................................................................................................643Syntax of piecewise linear functions...........................................................................................................644Discontinuous piecewise linear functions...................................................................................................646Isolated points in piecewise linear functions...............................................................................................649Using IloPiecewiseLinear in expressions...................................................................................................650Describing the problem..............................................................................................................................651

    Problem statement..........................................................................................................................652Variable shipping costs...................................................................................................................653Model with varying costs.................................................................................................................655

    Developing a model....................................................................................................................................657Creating the environment and model..............................................................................................658Representing the data.....................................................................................................................659Adding constraints...........................................................................................................................660Checking convexity and concavity...................................................................................................661Adding an objective.........................................................................................................................662

    Solving the problem....................................................................................................................................663Displaying a solution...................................................................................................................................664Ending the application................................................................................................................................665Complete program: transport.cpp...............................................................................................................666

    U S E R ' S M A N U A L F O R C P L E X16

  • Logical constraints in optimization.......................................................................................667What are logical constraints?.....................................................................................................................668What can be extracted from a model with logical constraints?...................................................................669

    Overview.........................................................................................................................................670Logical constraints in the C++ API..................................................................................................671Logical constraints in the Java API.................................................................................................672Logical constraints in the .NET API.................................................................................................673

    Which nonlinear expressions can be extracted?........................................................................................674Logical constraints for counting..................................................................................................................675Logical constraints as binary variables.......................................................................................................676How are logical constraints extracted?.......................................................................................................677Indicator constraints in optimization....................................................................................679What is an indicator constraint?.................................................................................................................680Example: fixnet.c........................................................................................................................................681Indicator constraints in the Interactive Optimizer........................................................................................682What are indicator variables?.....................................................................................................................683Restrictions on indicator constraints...........................................................................................................684Best practices with indicator constraints.....................................................................................................685Using logical constraints: Food Manufacture 2...................................................................687Introducing the example.............................................................................................................................688Describing the problem..............................................................................................................................689Representing the data................................................................................................................................690Developing the model.................................................................................................................................693Formulating logical constraints...................................................................................................................694Solving the problem....................................................................................................................................695Early tardy scheduling............................................................................................................697Describing the problem..............................................................................................................................699Understanding the data file........................................................................................................................700Reading the data........................................................................................................................................701Creating variables.......................................................................................................................................702Stating precedence constraints..................................................................................................................703Stating resource constraints.......................................................................................................................704Representing the piecewise linear cost function........................................................................................705Transforming the problem...........................................................................................................................706Solving the problem....................................................................................................................................707Using column generation: a cutting stock example.............................................................709What is column generation?.......................................................................................................................711Column-wise models in Concert Technology..............................................................................................712Describing the problem..............................................................................................................................713Representing the data................................................................................................................................715Developing the model: building and modifying...........................................................................................717

    The master model and column generator in this application...........................................................718

    U S E R ' S M A N U A L F O R C P L E X 17

  • Adding extractable objects: both ways............................................................................................719Adding columns to a model.............................................................................................................720Changing the type of a variable......................................................................................................721Cut optimization model....................................................................................................................722Pattern generator model.................................................................................................................723

    Changing the objective function.................................................................................................................724Solving the problem: using more than one algorithm.................................................................................725Ending the program....................................................................................................................................727Complete program......................................................................................................................................728

    Infeasibility and unboundedness..........................................................................729Preprocessing and feasibility.................................................................................................731Issues of infeasibility and unboundedness.................................................................................................732Early reports of infeasibility based on preprocessing reductions...............................................................733Managing unboundedness.....................................................................................................735What is unboundedness?...........................................................................................................................736Avoiding unboundedness in a model..........................................................................................................737Diagnosing unboundedness.......................................................................................................................738Diagnosing infeasibility by refining conflicts.......................................................................739What is a conflict?......................................................................................................................................741What a conflict is not..................................................................................................................................742How to invoke the conflict refiner................................................................................................................743How a conflict differs from an IIS................................................................................................................744Meet the conflict refiner in the Interactive Optimizer..................................................................................745

    Limits of the conflict refiner in the Interactive Optimizer..................................................................746A model for the conflict refiner........................................................................................................747Optimizing the example...................................................................................................................748Interpreting the results and detecting conflict.................................................................................749Displaying a conflict in the Interactive Optimizer.............................................................................750

    Interpreting conflict.....................................................................................................................................751Understanding the conflict in the model..........................................................................................752Deleting a constraint.......................................................................................................................753Understanding a conflict report.......................................................................................................755Summing equality constraints.........................................................................................................756Changing a bound...........................................................................................................................757Adding a constraint.........................................................................................................................758Changing bounds on cost...............................................................................................................759Relaxing a constraint.......................................................................................................................760

    More about the conflict refiner....................................................................................................................761Refining a conflict in a MIP start.................................................................................................................763Using the conflict refiner in an application..................................................................................................765

    Example: modifying ilomipex2.cpp..................................................................................................766What belongs in an application to refine conflict.............................................................................768

    U S E R ' S M A N U A L F O R C P L E X18

  • Comparing a conflict application to Interactive Optimizer...........................................................................769Preferences in the conflict refiner....................................................................................................770Groups in the conflict refiner...........................................................................................................771

    Repairing infeasibilities with FeasOpt...................................................................................773What is FeasOpt?.......................................................................................................................................774Invoking FeasOpt........................................................................................................................................775Specifying preferences...............................................................................................................................776Example: FeasOpt in Concert Technology.................................................................................................777

    Advanced programming techniques....................................................................783User-cut and lazy-constraint pools........................................................................................785What are user cuts and lazy constraints?...................................................................................................786What are pools of user cuts or lazy constraints?........................................................................................787Differences between user cuts and lazy constraints..................................................................................788Limitations on pools in the C API...............................................................................................................789Adding user cuts and lazy constraints........................................................................................................791

    Using the Component Libraries.......................................................................................................792Using the Interactive Optimizer.......................................................................................................793Reading and writing LP files...........................................................................................................794Reading and writing SAV files.........................................................................................................796Reading and writing MPS files........................................................................................................797

    Deleting user cuts and lazy constraints......................................................................................................799Using goals..............................................................................................................................801Branch & cut with goals..............................................................................................................................803

    What is a goal?...............................................................................................................................804Overview of goals in the search......................................................................................................805How goals are implemented in branch & cut...................................................................................806About the method execute in a goal................................................................................................807

    Special goals in branch & cut.....................................................................................................................809Or goal............................................................................................................................................810And goal..........................................................................................................................................811Fail goal...........................................................................................................................................812Local cut goal..................................................................................................................................813Null goal..........................................................................................................................................814Branch as CPLEX goal...................................................................................................................815Solution goal...................................................................................................................................816

    Aggregating goals......................................................................................................................................817Example: goals in branch & cut...................................................