Initializing help system before first use

Introduction

The Xpress Python interface allows for creating and solving optimization problems using the Python programming language and the FICO Xpress Optimizer library. This manual describes how to use the Xpress Python interface.

Outline

The following chapters cover:

It is assumed here that the reader has basic understanding of the Python programming language. Ample documentation on Python is available at http://docs.python.org, including a tutorial and a reference manual. Unless specified otherwise, Python 3 is used in all of the examples and code samples throughout this manual. The current version of the Xpress Python interface works on Python 2.7, Python 3.4, and subsequent versions.

Installing the Python Xpress module

Installation from the Xpress Optimizer distribution

Using the Xpress Optimizer suite, the module is automatically installed by the installation script. If xpress_dir is the directory where the Xpress Optimizer suite was installed (for example c:\xpressmp for Windows users or /opt/xpressmp for *nix users), then the Python module is at xpress_dir/lib for *nix users and xpress_dir\bin for Windows users.

Documentation is available in PDF form in the installation: see xpress_dir/docs/python/xpress_python_interface.pdf.

Installation from Conda

A Conda package is available for download with the following command:

conda install -c fico-xpress xpress

Conda packages for Python 2.7 and 3.4 and subsequent versions are available, for Windows, Linux, and MacOS. The Conda package contains the Python interface module and its documentation, but not the Xpress Optimizer's libraries, its documentation, or a license. Please refer to the FICO Xpress Optimizer web pages for instructions on how to obtain a full installation of the Xpress optimization suite, which also contains an installation package that is compatible with Conda.

Troubleshooting the installation

Whether the Xpress Python module is downloaded from the Conda server or used from the Xpress installation, there are a few remarks that might help ensure that the installation works right away. The advice below is independent of the Python platform (PyCharm, Spyder, etc.) that may be in use.

The Xpress Python interface uses the Python package NumPy for some operation, hence NumPy must be installed. It is usually installed if a Conda installation is used, nevertheless ensure that version 1.13 or later is installed for Python versions 2.7, 3.5, and 3.6, and version 1.11 is installed for Python 3.4.

As a general note, always ensure that the PATH environment variable (for Windows; for Linux, it is LD_LIBRARY_PATH, and for MacOS there is the additional variable DYLD_LIBRARY_PATH) contains the location of the libraries of the Xpress installation, which is C:\xpressmp\bin (for Windows, or /opt/xpressmp/lib for Linux and MacOS). When using a Conda installation and installing the Xpress Python interface from Conda, if the Conda-located Xpress packages are preferred then the PATH should contain the Conda library directories before C:\xpressmp\bin.

For MacOS users, it might be useful to alter the linking settings of the Python modules. All such modules (named xpress.*.so) depend on libxprs.dylib, and the modules are given the correct absolute path of the installation directory containing libxprs.dylib. Should the location of this library change, the dependency has to be updated on the modules as well with the command

install_name_tool -change libxprs.dylib /path/to/libxprs.dylib xpress.so