xpress 9.6.2
FICO Xpress Optimizer Python interface
Keywords: optimization mip minlp xpress

FICO&#174; 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:
```python
import xpress as xp
p = xp.problem(name='myexample')  # problem name (optional)
x1 = p.addVariable(vartype=xp.integer, name='x1', lb=-10, ub=10)
x2 = p.addVariable(name='x2')
p.setObjective(x1**2 + 2*x2)      # objective function
p.addConstraint(x1 + 3*x2 >= 4)   # one or more constraints
p.optimize()
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&#174; programming language and the [FICO Xpress](http://www.fico.com/en/products/fico-xpress-optimization-suite) 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](https://www.pypi.org) and from [Anaconda](https://www.anaconda.com). 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 directory `examples` with several examples of usages of the module, with varying degrees of difficulty, and a directory `license` containing the [Xpress Community License](http://subscribe.fico.com/xpress-optimization-community-license) The full HTML documentation for the Xpress Optimizer, including the Python interface and its examples, is available at the [FICO Xpress Optimization Help](http://www.fico.com/fico-xpress-optimization/docs/latest/solver/GUID-ACD7E60C-7852-36B7-A78A-CED0EA291CDD.html) 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`.

For a list of supported versions and their end of support dates, please see https://www.fico.com/en/product-support/support-level-software-release. Customers can download selected older versions of the package from the Xpress client area site by clicking on the Archived Downloads link.

Licensing
---------

The Xpress software is governed by the [Xpress Shrinkwrap License Agreement](https://www.fico.com/en/shrinkwrap-license-agreement-fico-xpress-optimization-suite-on-premises). When downloading the package, you accept the license terms. A copy of the Xpress Shrinkwrap License is stored in the file `LICENSE.txt` in the `dist-info` directory of the Xpress module.

This package includes the community license of Xpress, see the [licensing options overview](https://community.fico.com/s/fico-xpress-optimization-licensing-optio) for more details.


Miscellaneous
-------------

"Python" is a registered trademark of the Python Software Foundation. "FICO" is a registered trademark of Fair Isaac Corporation in the United States and may be a registered trademark of Fair Isaac Corporation in other countries. Other product and company names herein may be trademarks of their respective owners.

Copyright (C) Fair Isaac 1983-2025