IBM ILOG CPLEX Optimization Studio Getting Started with CPLEX

IBM ILOG CPLEX Optimization Studio Getting Started with CPLEX

IBM IBM ILOG CPLEX Optimization Studio Getting Started with CPLEX Version 12 Release 8 IBM IBM ILOG CPLEX Optimization Studio Getting Started with CPLEX Version 12 Release 8 Copyright notice Describes general use restrictions and trademarks related to this document and the software described in this document. © Copyright IBM Corp. 1987, 2017 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Trademarks IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. 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. Additional registered trademarks, copyrights, licenses IBM ILOG CPLEX states these additional registered trademarks, copyrights, and acknowledgements. Python is a registered trademark of the Python Software Foundation. MATLAB is a registered trademark of The MathWorks, Inc. OpenMPI is distributed by The Open MPI Project under the New BSD license and copyright 2004 - 2012. MPICH2 is copyright 2002 by the University of Chicago and Argonne National Laboratory. © Copyright IBM Corporation 1987, 2017. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Introducing CPLEX .......... v Solution options ............ 31 What is CPLEX? ............. v Displaying post-solution information ..... 32 Types of problems solved ......... v Performing sensitivity analysis ........ 33 CPLEX components........... vi Writing problem and solution files....... 34 Optimizer options ........... vii Overview .............. 34 Parallel optimizers............ viii Selecting a write file format ........ 35 Data entry options............ viii Writing LP files ............ 35 What CPLEX is not ........... viii Writing basis files ........... 36 What you need to know .......... ix Using path names ........... 36 What’s in this manual ........... ix Reading problem files ........... 37 Notation in this manual .......... x Overview .............. 37 Related documentation ........... x Selecting a read file format ........ 37 Reading LP files ............ 37 Chapter 1. Setting up CPLEX...... 1 Using file extensions .......... 38 Reading MPS files ........... 38 Installing CPLEX ............. 1 Reading basis files ........... 39 Setting up CPLEX on Windows ........ 1 Setting CPLEX parameters ......... 39 Setting up CPLEX on GNU/Linux/macOS .... 2 Adding constraints and bounds ....... 41 Setting up Eclipse for the Java API of CPLEX ... 4 Changing a problem ........... 42 Setting up the Python API of CPLEX ...... 5 Overview .............. 42 Directory structure of CPLEX ......... 6 What can be changed?.......... 42 Using the Component Libraries ........ 7 Changing constraint or variable names .... 42 Changing sense ............ 43 Chapter 2. Solving an LP with CPLEX 11 Changing bounds ........... 43 Overview ............... 11 Removing bounds ........... 44 Problem statement ............ 11 Changing coefficients of variables ...... 44 Using the Interactive Optimizer........ 11 Objective and RHS coefficients ....... 44 Using Concert Technology in C++ ....... 12 Deleting entire constraints or variables .... 45 Using Concert Technology in Java ....... 13 Changing small values to zero ....... 46 Using Concert Technology in .NET ...... 13 Executing operating system commands ..... 46 Using the Callable Library ......... 14 Quitting CPLEX ............. 47 Using the Python API ........... 16 Advanced features of the Interactive Optimizer .. 47 Chapter 3. Interactive Optimizer tutorial 19 Chapter 4. C++ tutorial ........ 49 Starting CPLEX ............. 19 The design of CPLEX in Concert Technology C++ Using help............... 19 applications .............. 49 Entering a problem ............ 21 Compiling CPLEX in Concert Technology C++ Overview .............. 21 applications .............. 50 Entering the example .......... 21 Testing your installation on UNIX ...... 50 Using the LP format .......... 22 Testing your installation on Windows..... 50 Entering data ............. 24 In case of problems........... 50 Input limit for commands in the Interactive The anatomy of a Concert Technology C++ Optimizer .............. 24 application .............. 51 Displaying a problem ........... 24 Constructing the environment: IloEnv .... 51 Verifying a problem with the display command 25 Creating a model: IloModel ........ 52 Displaying problem statistics ....... 26 Solving the model: IloCplex ........ 54 Specifying item ranges.......... 27 Querying results............ 54 Displaying variable or constraint names .... 27 Handling errors ............ 55 Ordering variables ........... 28 Building and solving a small LP model in C++ .. 56 Displaying constraints .......... 28 Overview .............. 56 Displaying the objective function ...... 28 Modeling by rows ........... 57 Displaying bounds ........... 29 Modeling by columns .......... 57 Displaying a histogram of nonzero counts ... 29 Modeling by nonzero elements ....... 58 Solving a problem ............ 30 Writing and reading models and files...... 58 Where you are ............ 30 Selecting an optimizer ........... 59 Solving the example .......... 30 © Copyright IBM Corp. 1987, 2017 iii Reading a problem from a file: example ilolpex2.cpp 60 Building Callable Library applications on UNIX Overview .............. 60 platforms .............. 84 Reading the model from a file ....... 60 Building Callable Library applications on Win32 Selecting the optimizer ......... 61 platforms .............. 84 Accessing basis information ........ 61 How CPLEX works............ 85 Querying quality measures ........ 61 Overview .............. 85 Modifying and re-optimizing ........ 61 Opening the CPLEX environment ...... 85 Modifying an optimization problem: example Instantiating the problem object ...... 86 ilolpex3.cpp .............. 62 Populating the problem object ....... 86 Overview .............. 62 Changing the problem object ....... 86 Setting CPLEX parameters ........ 63 Creating a successful Callable Library application 87 Modifying an optimization problem ..... 63 Overview .............. 87 Starting from a previous basis ....... 63 Prototype the model .......... 87 Complete program ........... 63 Identify the routines to call ........ 87 Test procedures in the application ...... 87 Chapter 5. Java tutorial ....... 65 Assemble the data ........... 88 Overview ............... 65 Choose an optimizer .......... 88 Compiling CPLEX in Concert Technology Java Observe good programming practices .... 89 applications .............. 65 Debug your program .......... 89 Paths and JARs ............ 65 Test your application .......... 89 Adapting build procedures to your platform .. 65 Use the examples ........... 89 In case problems arise .......... 66 Building and solving a small LP model in C ... 90 The design of CPLEX in Concert Technology Java Reading a problem from a file: example lpex2.c .. 91 applications .............. 67 Adding rows to a problem: example lpex3.c ... 92 The anatomy of a Concert Technology Java Performing sensitivity analysis ........ 94 application .............. 67 Structure of an application ........ 67 Chapter 8. Python tutorial ...... 97 Create the model ........... 68 Design of CPLEX in a Python application .... 97 Solve the model ............ 69 Starting the CPLEX Python API ....... 97 Query the results ........... 70 Accessing the module cplex ......... 97 Building and solving a small LP model in Java .. 70 Building and solving a small LP with Python ... 98 Example: LPex1.java .......... 70 Reading and writing CPLEX models to files with Modeling by rows ........... 72 Python ................ 98 Modeling by columns .......... 72 Selecting an optimizer in Python ....... 99 Modeling by nonzeros .......... 73 Example: reading a problem from a file lpex2.py 100 Modifying and re-optimizing in the CPLEX Python Chapter 6. .NET tutorial ....... 75 API................. 100 Presenting the tutorial ........... 75 Example: modifying a model lpex3.py ..... 101 What you need to know: prerequisites ..... 75 Using CPLEX parameters in the CPLEX Python What you will be doing .......... 76 API................. 102 Describe ............... 77 Model ................ 78 Acknowledgment of use: dtoa routine Solve ................ 81 of the gdtoa package ........ 105 Complete program ............ 82 Further acknowledgments: AMPL... 107 Chapter 7. Callable Library tutorial... 83 The design of the CPLEX Callable Library .... 83 Index ............... 109 Compiling and linking Callable Library applications 83 Overview .............

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    130 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us