CONTENTS
ILOG CPLEX 10.2 User's Manual
Meet ILOG CPLEX
Languages and APIs
ILOG Concert Technology for C++ Users
Architecture of a CPLEX C++ Application
Licenses
Compiling and Linking
Creating a C++ Application with Concert Technology
Modeling an Optimization Problem with Concert Technology
Modeling Classes
Data Management Classes
Solving the Model
Extracting a Model
Invoking a Solver
Choosing an Optimizer
Controlling the Optimizers
Accessing Solution Information
Accessing Solution Status
Querying Solution Data
Accessing Basis Information
Performing Sensitivity Analysis
Analyzing Infeasible Problems
Solution Quality
Modifying a Model
Deleting and Removing Modeling Objects
Changing Variable Type
Handling Errors
Example: Optimizing the Diet Problem in C++
Problem Representation
Creating a Model Row by Row
Creating a Model Column by Column
Application Description
Creating Multi-Dimensional Arrays with IloArray
Using Arrays for Input/Output
Solving the Model with IloCplex
Complete Program
ILOG Concert Technology for Java Users
Architecture of a CPLEX Java Application
Licenses
Compiling and Linking
Creating a Java Application with Concert Technology
Modeling an Optimization Problem with Concert Technology
Using IloModeler
The Active Model
Building the Model
Solving the Model
Accessing Solution Information
Choosing an Optimizer
Solving a Single Continous Model
Solving Subsequent Continuous Relaxations in a MIP
Controlling ILOG CPLEX Optimizers
Parameters
Priority Orders and Branching Directions
More Solution Information
Writing Solution Files
Dual Solution Information
Basis Information
Infeasible Solution Information
Solution Quality
Advanced Modeling with IloLPMatrix
Modeling by Column
Example: Optimizing the Diet Problem in Java
Modifying the Model
ILOG Concert Technology for .NET Users
Describe
Model
Build by Rows
Build by Columns
Solve
Good Programming Practices
Example: Optimizing the Diet Problem in C#.NET
ILOG CPLEX Callable Library
Architecture of the ILOG CPLEX Callable Library
Licenses
Compiling and Linking
Using the Callable Library in an Application
Initialize the ILOG CPLEX Environment
Instantiate the Problem Object
Put Data in the Problem Object
Optimize the Problem
Change the Problem Object
Destroy the Problem Object
Release the ILOG CPLEX Environment
ILOG CPLEX Programming Practices
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 Problem Data
Callbacks
Portability
FORTRAN Interface
C++ Interface
Managing Parameters from the Callable Library
Example: Optimizing the Diet Problem in the Callable Library
Problem Representation
Program Description
Solving the Model with CPXlpopt
Using Surplus Arguments for Array Allocations
Example: Using Query Routines lpex7.c
Programming Considerations
Developing CPLEX Applications
Tips for Successful Application Development
Prototype the Model
Identify Routines to Use
Test Interactively
Assemble Data Efficiently
Test Data
Choose an Optimizer
Program with a View toward Maintenance and Modifications
Using the Interactive Optimizer for Debugging
Eliminating Common Programming Errors
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
Managing Input and Output
Understanding File Formats
Working with LP Files
Working with MPS Files
Converting File Formats
Using Concert XML Extensions
Using Concert csvReader
Managing Log Files
Creating, Renaming, Relocating Log Files
Closing Log Files
Controlling Message Channels
Parameter for Output Channels
Callable Library Routines for Message Channels
Example: Callable Library Message Channels
Concert Technology Message Channels
Licensing an Application
Types of ILM Runtime Licenses
File-Based RTNODE, RTSTOKEN or TOKEN Keys
Memory-Based RUNTIME Keys
Routines and Methods Used for Licensing
Examples
CPXputenv Routine for C and C++ Users
The putenv Method for Java Users
The Putenv Method for .NET Users
CPXRegisterLicense Routine for C and C++ Users
The registerLicense Method for Java Users
The RegisterLicense Method for .NET Users
Summary
Continuous Optimization
Solving LPs: Simplex Optimizers
Choosing an Optimizer for Your LP Problem
Automatic Selection of Optimizer
Dual Simplex Optimizer
Primal Simplex Optimizer
Network Optimizer
Barrier Optimizer
Sifting Optimizer
Concurrent Optimizer
Parameter Settings and Optimizer Choice
Tuning LP Performance
Preprocessing
Starting from an Advanced Basis
Simplex Parameters
Diagnosing Performance Problems
Lack of Memory
Numeric Difficulties
Diagnosing LP Infeasibility
Coping with an Ill-Conditioned Problem or Handling Unscaled Infeasibilities
Interpreting Solution Quality
Finding a Conflict
Repairing Infeasibility: FeasOpt
Example: Using a Starting Basis in an LP Problem
Example ilolpex6.cpp
Example lpex6.c
Solving LPs: Barrier Optimizer
Introducing the Barrier Optimizer
Using the Barrier Optimizer
Special Options
Controlling Crossover
Using SOL File Format
Interpreting the Barrier Log File
Nonzeros in Lower Triangle of AAT in the Log File
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 LP Optimizer
Tuning Barrier Optimizer Performance
Memory Emphasis: Letting the Optimizer Use Disk for Storage
Preprocessing
Detecting and Eliminating Dense Columns
Choosing an Ordering Algorithm
Using a Starting-Point Heuristic
Overcoming Numeric Difficulties
Numerical Emphasis Settings
Difficulties in the Quality of Solution
Difficulties during Optimization
Difficulties with Unbounded Problems
Diagnosing Infeasibility Reported by Barrier Optimizer
Solving Network-Flow Problems
Choosing an Optimizer: Network Considerations
Formulating a Network Problem
Example: Network Optimizer in the Interactive Optimizer
Understanding the Network Log File
Tuning Performance of the Network Optimizer
Solving Problems with the Network Optimizer
Network Extraction
Preprocessing and the Network Optimizer
Example: Using the Network Optimizer with the Callable Library netex1.c
Solving Network-Flow Problems as LP Problems
Example: Network to LP Transformation netex2.c
Solving Problems with a Quadratic Objective (QP)
Identifying Convex QPs
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
Example: Creating a QP, Optimizing, Finding a Solution
Example: iloqpex1.cpp
Example: QPex1.java
Example: qpex1.c
Example: Reading a QP from a File qpex2.c
Solving Problems with Quadratic Constraints (QCP)
Identifying a Quadratically Constrained Program (QCP)
Convexity
Semi-definiteness
Second Order Cone Programming (SOCP)
Determining Problem Type
Concert Technology and QCP Problem Type
Callable Library and QCP Problem Type
Interactive Optimizer and QCP Problem Type
File Formats and QCP Problem Type
Changing Problem Type
Changing Quadratic Constraints
Solving with Quadratic Constraints
Numeric Difficulties and Quadratic Constraints
Examples: QCP
Discrete Optimization
Solving Mixed Integer Programming Problems (MIP)
Stating a MIP Problem
Considering Preliminary Issues
Entering MIP Problems
Displaying MIP Problems
Changing Problem Type in MIPs
Changing Variable Type
Using the Mixed Integer Optimizer
Emphasizing Feasibility and Optimality
Terminating MIP Optimization
Tuning Performance Features of the Mixed Integer Optimizer
Branch & Cut
Probing
Cuts
Heuristics
Preprocessing: Presolver and Aggregator
Starting from a Solution
Issuing Priority Orders
Using the MIP Solution
Progress Reports: Interpreting the Node Log
Troubleshooting MIP Performance Problems
Too Much Time at Node 0
Trouble Finding More than One Feasible Solution
Large Number of Unhelpful Cuts
Lack of Movement in the Best Node
Time Wasted on Overly Tight Optimality Criteria
Slightly Infeasible Integer Variables
Running out of Memory
Difficulty Solving Subproblems: Overcoming Degeneracy
Unsatisfactory Subproblem Optimization
Examples: Optimizing a Basic MIP Problem
ilomipex1.cpp
mipex1.c
Example: Reading a MIP Problem from a File
ilomipex2.cpp
mipex2.c
Using Special Ordered Sets (SOS)
What Is a Special Ordered Set (SOS)?
Example: SOS Type 1 for Sizing a Warehouse
Declaring SOS Members
Examples: Using SOS and Priority
ilomipex3.cpp
mipex3.c
Using Semi-Continuous Variables: a Rates Example
What Are Semi-Continuous Variables?
Describing the Problem
Representing the Problem
Building a Model
Solving the Problem
Ending the Application
Complete Program
Using Piecewise Linear Functions in Optimization: a Transport Example
Piecewise Linearity in ILOG CPLEX
What Is a Piecewise Linear Function?
Syntax of Piecewise Linear Functions
Discontinuous Piecewise Linear Functions
Isolated Points in Piecewise Linear Functions
Using IloPiecewiseLinear
Describing the Problem
Variable Shipping Costs
Model with Varying Costs
Developing a Model
Representing the Data
Adding Constraints
Checking Convexity and Concavity
Adding an Objective
Solving the Problem
Displaying a Solution
Ending the Application
Complete Program: transport.cpp
Logical Constraints in Optimization
What Are Logical Constraints?
What Can Be Extracted from a Model with Logical Constraints?
Logical Constraints in the C++ API
Logical Constraints in the Java API
Logical Constraints in the .NET API
Which Nonlinear Expressions Can Be Extracted?
Logical Constraints for Counting
Logical Constraints as Binary Variables
How Are Logical Constraints Extracted?
Using Indicator Constraints
What Is an Indicator Constraint?
Example: fixnet.c
Indicator Constraints in the Interactive Optimizer
What Are Indicator Variables?
Restrictions on Indicator Constraints
Best Practices with Indicator Constraints
Using Logical Constraints: Food Manufacture 2
Describing the Problem
Representing the Data
What Is Known?
What Is Unknown?
What Are the Constraints?
What Is the Objective?
Developing the Model
Using Logical Constraints
Solving the Problem
Ending the Program
Early Tardy Scheduling
Describing the Problem
Understanding the Data File
Reading the Data
Creating Variables
Stating Precedence Constraints
Stating Resource Constraints
Representing the Piecewise Linear Cost Function
Transforming the Problem
Solving the Problem
Using Column Generation: a Cutting Stock Example
What Is Column Generation?
Column-Wise Models in Concert Technology
Describing the Problem
Representing the Data
Developing the Model: Building and Modifying
Adding Extractable Objects: Both Ways
Adding Columns to a Model
Changing the Type of a Variable
Cut Optimization Model
Pattern Generator Model
Changing the Objective Function
Solving the Problem: Using More than One Algorithm
Ending the Program
Complete Program
Infeasibility and Unboundedness
Preprocessing and Feasibility
Managing Unboundedness
What Is Unboundedness?
Avoiding Unboundedness
Diagnosing Unboundedness
Diagnosing Infeasibility by Refining Conflicts
What Is a Conflict?
What a Conflict Is Not
How to Invoke the Conflict Refiner
How a Conflict Differs from an IIS
Meet the Conflict Refiner in the Interactive Optimizer
A Model for the Conflict Refiner
Optimizing the Example
Interpreting the Results and Detecting Conflict
Displaying a Conflict
Interpreting Conflict
More about the Conflict Refiner
Using the Conflict Refiner in an Application
What Belongs in an Application to Refine Conflict
Conflict Application vs Interactive Optimizer
Repairing Infeasibilities with FeasOpt
What Is FeasOpt?
Invoking FeasOpt
Specifying Preferences
Example: FeasOpt in Concert Technology
Advanced Programming Techniques
User-Cut and Lazy-Constraint Pools
What Are Pools of User Cuts or Lazy Constraints?
Adding User Cuts and Lazy Constraints
Using Component Libraries
Using the Interactive Optimizer
Reading and Writing LP Files
Reading and Writing SAV Files
Reading and Wrtiting MPS Files
Deleting User Cuts and Lazy Constraints
Using Goals
Branch & Cut with Goals
Overview of Goals in Branch & Cut
How Goals Are Implemented in Branch & Cut
About the Method execute in Branch & Cut
Special Goals in Branch & Cut
Or Goal
And Goal
Fail Goal
Local Cut Goal
Null Goal
Branch as CPLEX Goal
Solution Goal
Aggregating Goals
Example: Goals in Branch & Cut
The Goal Stack
Memory Management and Goals
Cuts and Goals
Injecting Heuristic Solutions
Controlling Goal-Defined Search
Example: Using Node Evaluators in a Node Selection Strategy
Search Limits
Using Callbacks
Diagnostic Callbacks
Implementing Callbacks in ILOG CPLEX with Concert Technology
Writing Callback Classes by Hand
Writing Callbacks with Macros
Callback Interface
The Continuous Callback
Example: Deriving the Simplex Callback ilolpex4.cpp
Implementing Callbacks in the Callable Library
Setting Callbacks
Callbacks for Continuous and Discrete Problems
Return Values for Callbacks
Interaction Between Callbacks and ILOG CPLEX Parallel Optimizers
Example: Using Callbacks lpex4.c
Control Callbacks for IloCplex
Example: Controlling Cuts iloadmipex5.cpp
Goals and Callbacks: a Comparison
Advanced Presolve Routines
Introduction to Presolve
A Proposed Example
Restricting Presolve Reductions
Adding Constraints to the First Solution
Primal and Dual Considerations in Presolve Reductions
Cuts and Presolve Reductions
Infeasibility or Unboundedness in Presolve Reductions
Protected Variables in Presolve Reductions
Manual Control of Presolve
Modifying a Problem
Advanced MIP Control Interface
Introduction to MIP Callbacks
Heuristic Callback
Cut Callback
Branch Selection Callback
Incumbent Callback
Node Selection Callback
Solve Callback
Parallel Optimizers
Threads
Example: Threads and Licensing
Threads and Performance Considerations
Nondeterminism
Clock Settings and Time Measurement
Using Parallel Optimizers in the Interactive Optimizer
Using Parallel Optimizers in the ILOG CPLEX Component Libraries
Parallel Barrier Optimizer
Concurrent Optimizer
Parallel MIP Optimizer
Memory Considerations and the Parallel MIP Optimizer
Output from the Parallel MIP Optimizer
Index