Skip to main content

FICO Xpress Optimizer Python interface

Project description

Xpress Python interface

Create and solve Mathematical Optimization problems like the following:

min  x1^2 + 2 x2
s.t. x1 + 3 x2 >= 4
     -10 <= x1 <= 10
     x1 in Z
     x2 >= 0

with just a few lines of code:

import xpress as xp
x1 = xp.var(vartype=xp.integer, name='x1', lb=-10, ub=10)
x2 = xp.var(name='x2')
p = xp.problem(x1, x2,            # variables of the problem
               x1**2 + 2*x2,      # single expression is taken as the objective function
               x1 + 3*x2 >= 4,    # one or more constraints
               name='myexample')  # problem name (optional)
p.solve()
print ("solution: {0} = {1}; {2} = {3}".format (x1.name, p.getSolution(x1), x2.name, p.getSolution(x2)))

With the xpress module, one can create and solve optimization problems using the Python programming language and the FICO Xpress Optimizer library. The module allows for

  • Creating, handling, solving, and querying optimization problems;
  • Using Python numerical libraries such as NumPy to create optimization problems;
  • Setting and getting the value of parameters (controls and attributes) of a problem; and
  • Using Python functions as callbacks for the Xpress Optimizer and the Xpress Nonlinear solver.

The Xpress Python interface allows for creating, handling, and solving all problems that can be solved with the FICO-Xpress library: Linear Programming (LP), Quadratic Programming (QP), Second-Order Conic Programming (SOCP), and their mixed-integer extensions: MILP, MIQP, MIQCQP, MISOCP, together with general nonlinear and mixed-integer nonlinear.

Installation

The Xpress Python interface can be downloaded from PyPI and from Anaconda. Run

pip install xpress

to install from PyPI, and

conda install -c fico-xpress xpress

to install from the Conda repository.

The downloaded package contains: a folder with several examples of usages of the module, with varying degrees of difficulty; a directory license containing the Xpress Community License; and a directory doc with the manual in PDF version---the full HTML documentation for the Xpress Optimizer's library, including the Python interface with its example, is also available at the FICO Xpress Optimization Help page.

If you do not have any FICO Xpress license, the community license will be recognized by the module and no further action is needed. If you do have a license, for instance located in /users/johndoe/xpauth.xpr, make sure to set the global environment variable XPRESS to point to the folder containing the xpauth.xpr file, i.e. XPRESS=/user/johndoe.

Licensing

The file community-xpauth.xpr license file in the license directory allows to solve problems with up to 5000 rows+columns. To obtain an unlimited license, please contact FICO at support@fico.com. Academic licenses are also unlimited and can be obtained via the Academic Partnership Program.

Copyright (C) Fair Isaac 1983-2020

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for xpress, version 8.9.0
Filename, size File type Python version Upload date Hashes
Filename, size xpress-8.9.0-cp27-cp27m-macosx_10_7_x86_64.whl (32.1 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size xpress-8.9.0-cp27-cp27mu-manylinux1_x86_64.whl (39.3 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size xpress-8.9.0-cp27-cp27m-win_amd64.whl (38.9 MB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size xpress-8.9.0-cp35-cp35m-macosx_10_6_x86_64.whl (32.1 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size xpress-8.9.0-cp35-cp35m-manylinux1_x86_64.whl (39.3 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size xpress-8.9.0-cp35-cp35m-win_amd64.whl (38.9 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size xpress-8.9.0-cp36-cp36m-macosx_10_9_x86_64.whl (32.1 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size xpress-8.9.0-cp36-cp36m-manylinux1_x86_64.whl (39.3 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size xpress-8.9.0-cp36-cp36m-win_amd64.whl (38.9 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size xpress-8.9.0-cp37-cp37m-macosx_10_9_x86_64.whl (32.1 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size xpress-8.9.0-cp37-cp37m-manylinux1_x86_64.whl (39.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size xpress-8.9.0-cp37-cp37m-win_amd64.whl (38.9 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size xpress-8.9.0-cp38-cp38-macosx_10_9_x86_64.whl (32.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size xpress-8.9.0-cp38-cp38-manylinux1_x86_64.whl (39.3 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size xpress-8.9.0-cp38-cp38-win_amd64.whl (38.9 MB) File type Wheel Python version cp38 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page