This repository contains Python notebook examples for two complementary Python interfaces to FICO® Xpress:
-
xpress— the FICO® Xpress Python API for building and solving optimization models directly in Python. See xpress on PyPI and the Python Interface Reference Manual. -
moselpy— Python API for FICO® Xpress Mosel, for compiling and running Mosel models from Python and exchanging data bidirectionally. Ideal for integrating existing Mosel models into Python data science workflows. See moselpy on PyPI and the MoselPy User Guide and Reference Manual.
The examples are organized into three top-level folders, one per notebook engine/API:
- xpress-api/ — Jupyter notebooks for the Xpress Python API (basic_api_examples/, modeling_examples/).
- moselpy/ — Jupyter notebooks for MoselPy.
- marimo/ — reactive, browser-based marimo notebooks for the Xpress Python API. Alternatively, you can browse a live read-only gallery of all marimo notebooks, no installation required.
-
Open Codespaces and create a codespace:
- Click on the "Code" (green) button on this repository page.
- On the "Codespaces" tab, select "Create a Codespace on main". This will set up a cloud-based development environment for you.
-
Open Python Notebook:
- Once the Codespace is 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
.ipynbextension) within the Codespace. - Click on the notebook file to open it in the Jupyter interface.
-
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, select the installed Python environment and wait for the code cell to be executed. You are all set to run all the code cells.
marimo notebooks require an extra step not needed for Jupyter: when creating the codespace, you must explicitly choose the "Marimo Xpress Notebooks" dev container configuration from the dropdown (via Create codespace > ... > New with options), instead of the default "Default (Jupyter)" configuration.
See marimo/README.md for the full walkthrough with screenshots.
The examples in this repository are licensed under the Apache License, Version 2.0. You may not use these files except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0, or see LICENSE for the full license text. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
The examples use FICO® Xpress software. By running them, you agree to the Community License terms of the Xpress Shrinkwrap License Agreement with respect to the FICO® Xpress software. See the licensing options overview for additional details and information about obtaining a paid license.