没有合适的资源?快使用搜索试试~ 我知道了~
首页CPLEX User's Manual-v12.4.pdf
资源详情
资源评论
资源推荐

IBM ILOG CPLEX Optimization Studio
CPLEXUser’sManual
Version12Release4

Copyright notice
Describes general use restrictions and trademarks related to this document and the software described in this document.
© Copyright IBM
®
Corp. 1987, 2011
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM Corp.
Trademarks
IBM, the IBM logo, ibm.com
®
, WebSphere
®
, and ILOG
®
are trademarks or registered trademarks of International Business
Machines Corp., in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other
companies. A current list of IBM trademarks is available on the Web at Copyright and trademark information.
Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe
Systems Incorporated in the United States, and/or other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States,
other countries, or both.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.
Other company, product, or service names may be trademarks or service marks of others.
Further acknowledgements
IBM ILOG CPLEX
®
states these additional registered trademarks and acknowledgements.
Additional registered trademarks
Python 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 package
IBM ILOG CPLEX acknowledges use of the dtoa routine of the gdtoa package, available at
http://www.netlib.org/fp/.
The author of this software is David M. Gay.
All Rights Reserved.
Copyright (C) 1998, 1999 by Lucent Technologies
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright notice appears in all copies and that both that the
copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that
the name of Lucent or any of its entities not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL LUCENT OR ANY OF ITS
ENTITIES BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
(end of acknowledgement of use of dtoa routine of the gdtoa package)
© Copyright IBM Corporation 1987, 2011.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.

Contents
Meet CPLEX.............xi
What is CPLEX? .............xi
What does CPLEX do? ...........xi
What you need to know ..........xiii
Examples online ............xiii
Notation in this manual ..........xv
Related documentation ..........xvi
Online services ............xviii
Further reading ............xviii
Part 1. Languages and APIs .....1
Chapter 1. Concert Technology for C++
users ................3
Overview ...............3
Architecture of a CPLEX C++ application.....3
Compiling and linking ...........4
Creating a C++ application with Concert Technology 4
Modeling an optimization problem with Concert
Technology ...............4
Overview ..............4
Creating the environment: IloEnv ......5
Defining variables and expressions: IloNumVar. . 5
Declaring the objective: IloObjective .....6
Adding constraints: IloConstraint and IloRange. . 6
Formulating a problem: IloModel ......7
Managing data ............7
Solving the model ............8
Overview ..............8
Extracting a model ...........10
Invoking a solver ...........10
Choosing an optimizer..........11
Controlling the optimizers ........12
Accessing solution information ........14
Accessing solution status .........14
Querying solution data .........15
Accessing basis information ........15
Performing sensitivity analysis .......15
Analyzing infeasible problems .......16
Assessing solution quality ........16
Modifying a model ............17
Overview ..............17
Deleting and removing modeling objects . . . 17
Changing variable type .........19
Handling errors .............19
Example: optimizing the diet problem in C++ . . . 20
Overview ..............20
Problem representation .........21
Application description .........22
Creating multi-dimensional arrays with IloArray 23
Using arrays for input or output ......23
Solving the model with IloCplex ......24
Complete program ...........25
Chapter 2. Concert Technology for
Java users .............27
Architecture of a CPLEX Java application ....27
Overview ..............27
Compiling and linking a Java application . . . 28
Creating a Java application with Concert Technology 28
Modeling an optimization problem with Concert
Technology in the Java API .........29
Overview ..............29
Using IloModeler ...........30
The active model ...........33
Building the model ...........33
Solving the model ............35
Accessing solution information ........36
Choosing an optimizer ..........37
Overview ..............37
What does CPLEX solve? .........37
Solving a single continuous model......38
Solving subsequent continuous relaxations in a
MIP................39
Controlling CPLEX optimizers ........39
Overview ..............39
Parameters .............40
Priority orders and branching directions ....40
More solution information .........41
Overview ..............41
Writing solution files ..........41
Dual solution information ........41
Basis information ...........42
Infeasible solution information .......42
Solution quality ............43
Advanced modeling with IloLPMatrix .....43
Modeling by column ...........44
What is modeling by column? .......44
Procedure for Modeling by Column .....45
Example: optimizing the diet problem in Java . . . 45
Modifying the model ...........47
Chapter 3. Concert Technology for
.NET users .............49
Prerequisites ..............49
Describe ...............49
Step 1: Describe the problem ........50
Step 2: Open the file ...........50
Model ................51
Step 3: Create the model ..........51
Step 4: Create an array to store the variables . . . 51
Step 5: Specify by row or by column ......52
Build by Rows .............52
Step 6: Set up rows ............52
Step 7: Create the variables: build and populate by
rows.................52
Step 8: Add objective ...........52
Step 9: Add nutritional constraints.......53
Build by Columns ............53
© Copyright IBM Corp. 1987, 2011 iii

Step 10: Set up columns ..........53
Step 11: Add empty objective function and
constraints...............53
Step 12: Create variables ..........54
Solve ................54
Step 13: Solve .............54
Step 14: Display the solution ........54
Step 15: End application ..........55
Good programming practices ........55
Step 16: Read the command line (data from user). . 55
Step 17: Show correct use of command line....55
Step 18: Enclose the application in try catch
statements ...............56
Example: optimizing the diet problem in C#.NET. . 56
Example: copying a model .........56
Chapter 4. Callable Library ......59
Architecture of the Callable Library ......59
Overview ..............59
Compiling and linking .........60
Using the Callable Library in an application . . . 60
Overview ..............60
Initialize the CPLEX environment ......60
Instantiate the problem as an object .....61
Put data in the problem object .......61
Optimize the problem ..........61
Change the problem object ........62
Destroy the problem object ........62
Release the CPLEX environment ......62
CPLEX programming practices ........62
Overview ..............62
Variable names and calling conventions ....63
Data types..............64
Ownership of problem data ........64
Problem size and memory allocation issues. . . 64
Status and return values .........65
Symbolic constants ...........65
Parameter routines ...........65
Null arguments ............66
Row and column references ........66
Character strings ...........66
Problem data .............67
Callbacks ..............68
Portability ..............68
FORTRAN interface ..........69
C++ interface .............71
Managing parameters from the Callable Library . . 71
Example: optimizing the diet problem in the
Callable Library .............72
Overview ..............72
Problem representation .........72
Program description ..........74
Solving the model with CPXlpopt ......74
Complete program ...........75
Using surplus arguments for array allocations . . . 75
Example: using query routines lpex7.c .....76
Chapter 5. CPLEX for Python users . . 79
Why Python? ..............79
Meet the Python API ...........80
Modifying and querying problem data in the
Python API ..............80
Using polymorphism in the Python API .....80
Example: generating a histogram .......81
Querying solution information in the Python API . 82
Examining variables with nonzero values in a
solution ...............83
Displaying high precision nonzero values of a
solution ...............83
Managing CPLEX parameters in the Python API . . 84
Using callbacks in the Python API .......84
Example: displaying solutions with increased
precision from the Python API ........85
Example: examining the simplex tableau in the
Python API ..............86
Example: solving a sequence of related problems in
the Python API .............86
Example: complex termination criteria in a callback 86
Part 2.
Programming considerations . . . 89
Chapter 6. Developing CPLEX
applications ............91
Tips for successful application development . . . 91
Prototype the model ..........91
Identify routines to use .........91
Test interactively ...........91
Assemble data efficiently .........92
Test data ..............92
Test and debug the model ........92
Choose an optimizer ..........93
Program with a view toward maintenance and
modifications .............93
Using the Interactive Optimizer for debugging . . 96
Eliminating common programming errors ....97
Turn on the data check parameter ......97
Check your include files .........97
Clean house and try again ........98
Read your messages ..........98
Check return values ..........98
Beware of numbering conventions ......98
Make local variables temporarily global ....98
Solve the problem you intended ......99
Special considerations for FORTRAN .....99
Tellus...............99
Chapter 7. Managing input and output 101
Platform limits on files ..........101
Representing very large models: 64-bit API . . . 101
Selecting an encoding ..........105
Understanding file formats .........107
Overview..............107
Working with LP files .........107
Working with MPS files .........108
Converting file formats .........109
Using Concert XML extensions .......110
Using Concert csvReader .........110
Managing log files ............111
iv CPLEX User’s Manual

Overview ..............111
Creating, renaming, relocating log files ....111
Closing log files ...........112
Controlling message channels ........112
Overview..............112
Output channels in the Interactive Optimizer 112
Callable Library routines for message channels 113
Example: Callable Library message channels . . 114
Concert Technology message channels ....115
Chapter 8. Timing interface .....117
Using the timing interface .........117
Chapter 9. Tuning tool .......119
Meet the tuning tool ...........119
Overview..............119
If CPLEX solves your problem to optimality . . 119
If CPLEX finds solutions but does not prove
optimality .............119
Tuning and time limits .........120
Tuning results ............120
Invoking the tuning tool..........120
Example: time limits on tuning in the Interactive
Optimizer ..............121
Fixing parameters and tuning multiple models in
the Interactive Optimizer .........122
Invoking the tuning tool in the Interactive
Optimizer .............122
Fixed parameters to respect .......122
Files of models to tune .........123
Tuning models in the Callable Library (C API) . . 123
Callbacks for tuning ...........124
Terminating a tuning session ........124
Part 3. Continuous optimization 127
Chapter 10. Solving LPs: simplex
optimizers .............129
Introducing the primal and dual optimizers . . . 129
Choosing an optimizer for your LP problem . . . 129
Overview of LP optimizers ........129
Automatic selection of an optimizer .....130
Dual simplex optimizer .........131
Primal simplex optimizer ........131
Network optimizer ..........131
Barrier optimizer ...........131
Sifting optimizer ...........131
Concurrent optimizer..........132
Parameter settings and optimizer choice . . . 132
Tuning LP performance ..........132
Introducing performance tuning for LP models 132
Preprocessing ............133
Starting from an advanced basis ......135
Simplex parameters ..........136
Diagnosing performance problems ......139
Lack of memory ...........139
Numeric difficulties ..........141
Diagnosing LP infeasibility .........145
Infeasibility reported by LP optimizers ....145
Coping with an ill-conditioned problem or
handling unscaled infeasibilities ......146
Interpreting solution quality .......147
Finding a conflict ...........149
Repairing infeasibility: FeasOpt ......150
Examples: using a starting basis in LP optimization 150
Overview..............150
Example ilolpex6.cpp ..........150
Example lpex6.c ...........151
Chapter 11. Solving LPs: barrier
optimizer .............153
Introducing the barrier optimizer .......153
Barrier simplex crossover .........154
Differences between barrier and simplex optimizers 154
Using the barrier optimizer.........155
Special options in the Interactive Optimizer . . . 156
Controlling crossover...........156
Using SOL file format ..........156
Interpreting the barrier log file .......156
Accessing and managing the log file of the
barrier optimizer ...........156
Sample log file from the barrier optimizer . . . 157
Sample log file from the augmented system
solver ...............157
Preprocessing in the log file .......158
Nonzeros in lower triangle of A*A' in the log
file ................158
Ordering-algorithm time in the log file ....158
Cholesky factor in the log file .......159
Iteration progress in the log file ......159
Infeasibility ratio in the log file ......159
Understanding solution quality from the barrier LP
optimizer...............160
Tuning barrier optimizer performance .....161
Overview of parameters for tuning the barrier
optimizer..............161
Memory emphasis: letting the optimizer use
disk for storage............163
Preprocessing ............164
Detecting and eliminating dense columns . . . 164
Choosing an ordering algorithm ......165
Using a starting-point heuristic ......165
Overcoming numeric difficulties .......166
Default behavior of the barrier optimizer with
respect to numeric difficulty .......166
Numerical emphasis settings .......166
Difficulties in the quality of solution.....167
Difficulties during optimization ......168
Difficulties with unbounded problems ....169
Diagnosing infeasibility reported by barrier
optimizer...............170
Chapter 12. Solving network-flow
problems .............171
Choosing an optimizer: network considerations 171
Formulating a network problem .......171
Example: network optimizer in the Interactive
Optimizer ..............172
Network flow problem description .....172
Contents v
剩余467页未读,继续阅读

















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0