FICO Xpress Optimizer Python Interface Reference Manual

FICO Xpress Optimizer Python Interface Reference Manual

R FICO Xpress Optimization Xpress Optimizer Python interface User’s manual Last update 3 June 2017 www.fico.com Make every decision countTM This material is the confidential, proprietary, and unpublished property of Fair Isaac Corporation. Receipt or possession of this material does not convey rights to divulge, reproduce, use, or allow others to use it without the specific written authorization of Fair Isaac Corporation and use must conform strictly to the license agreement. The information in this document is subject to change without notice. If you find any problems in this documentation, please report them to us in writing. Neither Fair Isaac Corporation nor its affiliates warrant that this documentation is error-free, nor are there any other warranties with respect to the documentation except as may be provided in the license agreement. ©1983–2017 Fair Isaac Corporation. All rights reserved. Permission to use this software and its documentation is governed by the software license agreement between the licensee and Fair Isaac Corporation (or its affiliate). Portions of the program may contain copyright of various authors and may be licensed under certain third-party licenses identified in the software, documentation, or both. In no event shall Fair Isaac Corporation or its affiliates be liable to any person for direct, indirect, special, incidental, or consequential damages, including lost profits, arising out of the use of this software and its documentation, even if Fair Isaac Corporation or its affiliates have been advised of the possibility of such damage. The rights and allocation of risk between the licensee and Fair Isaac Corporation (or its affiliates) are governed by the respective identified licenses in the software, documentation, or both. Fair Isaac Corporation and its affiliates specifically disclaim any warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The software and accompanying documentation, if any, provided hereunder is provided solely to users licensed under the Fair Isaac Software License Agreement. Fair Isaac Corporation and its affiliates have no obligation to provide maintenance, support, updates, enhancements, or modifications except as required to licensed users under the Fair Isaac Software License Agreement. FICO and Fair Isaac are trademarks or registered trademarks of Fair Isaac Corporation in the United States and may be trademarks or registered trademarks of Fair Isaac Corporation in other countries. Other product and company names herein may be trademarks of their respective owners. Xpress Optimizer Deliverable Version: A Last Revised: 3 June 2017 Contents 1 Introduction 1 1.1 Outline..............................................1 1.2 Installing the Python Xpress module.............................1 1.2.1 Installation from the Xpress Optimizer distribution................1 1.2.2 Installation from Conda................................2 2 Modeling an optimization problem3 2.1 Getting started.........................................3 2.2 Creating a problem.......................................3 2.3 Variables.............................................3 2.4 Constraints............................................4 2.5 Objective function........................................5 2.6 Special Ordered Sets (SOSs)..................................6 2.7 Indicator constraints......................................6 2.8 Modeling and solving nonlinear problems..........................6 2.9 Solving a problem........................................8 2.10 Querying a problem.......................................8 2.11 Reading and writing a problem................................ 10 2.12 Hints for building models efficiently............................. 10 3 Using Python numerical libraries 12 3.1 Using NumPy in the Xpress Python interface......................... 12 3.2 Products of NumPy arrays.................................... 13 4 Controls and Attributes 14 4.1 Controls.............................................. 14 4.2 Examples............................................. 15 4.3 Attributes............................................. 15 4.4 Examples............................................. 16 4.5 Accessing controls and attributes as object members................... 16 5 Using Callbacks 19 5.1 Introduction........................................... 19 6 Examples of use 21 6.1 Creating simple problems................................... 21 6.1.1 Generating a small Linear Programming problem................. 21 6.1.2 A Mixed Integer Linear Programming problem................... 22 6.2 Modeling examples....................................... 23 6.2.1 A simple model..................................... 23 6.2.2 Using IIS to investigate an infeasible problem................... 23 6.2.3 Modeling a problem using Python lists and vectors................ 24 6.2.4 A knapsack problem.................................. 24 6.2.5 A Min-cost-flow problem using NumPy....................... 25 6.2.6 A nonlinear model................................... 26 6.2.7 Finding the maximum-area n-gon.......................... 26 Fair Isaac Corporation Confidential and Proprietary Informationi Contents 6.2.8 Solving the n-queens problem............................. 27 6.2.9 Solving Sudoku problems............................... 27 6.3 Examples using NumPy..................................... 28 6.3.1 Using NumPy multidimensional arrays to create variables............. 28 6.3.2 Using the dot product to create arrays of expressions............... 29 6.3.3 Using the Dot product to create constraints and quadratic functions...... 29 6.3.4 Using NumPy to create quadratic optimization problems............. 30 6.4 Advanced examples: callbacks and problem querying/modifying............ 30 6.4.1 Visualize the branch-and-bound tree of a problem................ 30 6.4.2 Query and modify a simple problem......................... 32 6.4.3 Change a problem after solution........................... 32 6.4.4 Combining modeling and API functions....................... 34 6.4.5 A simple Traveling Salesman Problem (TSP) solver................. 34 7 Reference Manual 38 7.1 Using this chapter........................................ 38 Format of the reference.................................... 39 7.2 Global methods of the Xpress module............................ 39 7.3 Methods of the problem class................................. 40 7.4 Methods for branching objects................................ 42 7.5 Methods for adding/removing callbacks of a problem object............... 42 7.6 Methods to be used within a callback of a problem object................ 42 xpress.free............................................... 44 xpress.getbanner........................................... 45 xpress.getcheckedmode....................................... 46 xpress.getdaysleft........................................... 47 xpress.getlasterror.......................................... 48 xpress.getlicerrmsg.......................................... 49 xpress.getversion........................................... 50 xpress.init................................................ 51 xpress.setcheckedmode........................................ 52 xpress.setdefaults........................................... 53 xpress.setdefaultcontrol....................................... 54 xpress.Sum............................................... 55 xpress.Dot............................................... 56 xpress.Prod............................................... 58 xpress.exp............................................... 59 xpress.log................................................ 60 xpress.log10.............................................. 61 xpress.sin................................................ 62 xpress.cos................................................ 63 xpress.tan................................................ 64 xpress.asin............................................... 65 xpress.acos............................................... 66 xpress.atan............................................... 67 xpress.max............................................... 68 xpress.min............................................... 69 xpress.abs................................................ 70 xpress.sign............................................... 71 xpress.erf................................................ 72 xpress.erfc............................................... 73 xpress.sqrt............................................... 74 xpress.user............................................... 75 xpress.addcbmsghandler....................................... 76 xpress.removecbmsghandler..................................... 77 Fair Isaac Corporation Confidential and Proprietary Information ii Contents problem.addcbbariteration..................................... 78 problem.addcbbarlog......................................... 80 problem.addcbchgbranchobject................................... 81 problem.addcbcutlog......................................... 82 problem.addcbdestroymt...................................... 83 problem.addcbgapnotify....................................... 84 problem.addcbgloballog....................................... 86 problem.addcbinfnode........................................ 87 problem.addcbintsol......................................... 88 problem.addcblplog......................................... 89 problem.addcbmessage....................................... 90 problem.addcbmipthread.....................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    402 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