Blog Post

FICO® Xpress Optimization Blog
3 MIN READ

New Jupyter Notebook examples for FICO® Xpress Python API available on GitHub

FICO's avatar
FICO
Community Manager
1 year ago

The FICO® Xpress Python interface is a powerful tool for optimization modeling and solving. It allows users to leverage the capabilities of FICO® Xpress directly within Python. Here are some of its key features:

  1. Modeling: You can create and manipulate optimization models using Python objects. This includes defining variables, constraints, and objective functions. It allows creating constraints and objectives using expressions with operator overloading.
  2. Integration with NumPy and SciPy: The interface supports the use of NumPy and SciPy sparse arrays, making it easier and more efficient to handle large datasets and perform numerical operations.
  3. Solving: It provides functions to solve various types of optimization problems, including linear programming (LP), mixed-integer programming (MIP), quadratic programming (QP) and (general) nonlinear programming (NLP), and access to the full set of solver features available with Xpress.
  4. Callbacks: Users can implement custom callbacks to interact with the optimization process, such as for monitoring progress or modifying the solver's behaviour. In particular, the node callbacks make it possible to influence the branch-and-bound search and allow you to implement your own branching rules.
  5. Examples and Documentation: The interface comes with extensive examples and documentation to help users get started and explore advanced features.
A new series of Jupyter notebook examples have been published to GitHub, see  https://github.com/fico-xpress/python-notebooks. The examples range from basic API examples to more advanced modeling examples, and leverage Latex-formatted mathematical formulations, and the use of visualization elements such as tables, images, graphs and charts for a more interactive experience by the user.  

The notebooks can be downloaded and run locally using, for example, Visual Studio Code. Yet, the repository facilitates running the notebooks on a remote machine, without the need of any local installation, by using GitHub Codespaces directly from within the repository page.  To run the notebooks in GitHub Codespaces you will need a GitHub account.

Instructions:
  1. Open Codespaces and create a codespace:
    • Click on the "Code" (green) button on the repository page.
    • On the "Codespaces" tab, select "Create a codespace on main". This will set up a cloud-based development environment for you.
  2. Open Python Notebook:
    • Once the codespace has been created and the environment is ready (wait for the README preview to appear), you can open a Python notebook.
    • Navigate to a notebook file (with a .ipynb extension) within the codespace.
    • Click on the notebook file to open it in the Jupyter interface.
  3. Run the Notebook:
    • Run a code cell in the Python notebook as you would normally do in a local environment.
    • When running for the first time, select "Install/Enable suggested extensions: Python + Jupyter" as suggested in the pop-up window at the top of the screen.
    • After installation, the Python environment is automatically selected when running the code cell again. You are all set to run all the code cells.

We invite you to try out running the notebooks, either locally or in GitHub Codespaces, modify them and make your own experiments, or even build your own notebook examples from there.

Stay tuned to learn more about the newest features of FICO Xpress. Until then, you are welcome to try the Community Edition and experiment with Xpress using the included license (limits on problem size apply).

Updated 1 year ago
Version 3.0
No CommentsBe the first to comment