Skip to main content

FICO® Xpress Mosel Python Interface

Run FICO Xpress Mosel optimization models directly from Python. Define your model in Mosel, solve it with the full power of the Xpress solver, and exchange data and results with Python objects:

from io import BytesIO, StringIO
import moselpy as mp

MODEL = """
model "production"
  uses "mmxprs"
  declarations
    PRODUCTS = {"Chairs", "Tables", "Desks"}
    Profit:      array(PRODUCTS) of real
    Capacity:    real
    produce:     array(PRODUCTS) of mpvar
    TotalProfit: real
  end-declarations
  initializations from "moselpy:" Profit Capacity end-initializations
  forall(p in PRODUCTS) produce(p) is_integer
  sum(p in PRODUCTS) produce(p) <= Capacity
  maximize(sum(p in PRODUCTS) Profit(p) * produce(p))
  TotalProfit := getobjval
  initializations to "moselpy:" TotalProfit end-initializations
end-model
"""

mp.symbols["src"] = StringIO(MODEL)
mp.symbols["bim"] = BytesIO()
mp.compile_model("moselpy:src", "moselpy:bim")
del mp.symbols["src"]

mp.symbols["bim"].seek(0)
model = mp.load_model("moselpy:bim")
del mp.symbols["bim"]

results = model.run(input_data={
    "Profit":   {"Chairs": 45, "Tables": 80, "Desks": 120},
    "Capacity": 10,
})
print("Total profit:", results["TotalProfit"])

With the moselpy module, one can control Mosel optimization models using the Python® programming language. The module allows for:

  • Compiling, loading, and running Mosel models (.mos source or .bim binary)
  • Passing input data from Python to Mosel and retrieving results, supporting scalars, arrays, sets, dicts, NumPy arrays, and Pandas DataFrames
  • Redirecting Mosel output streams to Python file-like objects
  • Introspecting model symbols and querying solution status

Installation

Install from PyPI:

pip install moselpy

A valid FICO Xpress installation with Mosel support is required at runtime. Set the XPRESSDIR environment variable to point to the Xpress installation directory before importing the module.

Licensing

The Xpress software is governed by the Xpress Shrinkwrap License Agreement. 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 moselpy module.

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.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

moselpy-9.9.1-cp314-cp314-win_amd64.whl (113.5 kB view details)

Uploaded CPython 3.14Windows x86-64

moselpy-9.9.1-cp314-cp314-manylinux2014_aarch64.whl (164.4 kB view details)

Uploaded CPython 3.14

moselpy-9.9.1-cp314-cp314-manylinux1_x86_64.whl (174.5 kB view details)

Uploaded CPython 3.14

moselpy-9.9.1-cp314-cp314-macosx_11_0_arm64.whl (142.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

moselpy-9.9.1-cp313-cp313-win_amd64.whl (113.4 kB view details)

Uploaded CPython 3.13Windows x86-64

moselpy-9.9.1-cp313-cp313-manylinux2014_aarch64.whl (163.8 kB view details)

Uploaded CPython 3.13

moselpy-9.9.1-cp313-cp313-manylinux1_x86_64.whl (174.3 kB view details)

Uploaded CPython 3.13

moselpy-9.9.1-cp313-cp313-macosx_11_0_arm64.whl (142.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

moselpy-9.9.1-cp312-cp312-win_amd64.whl (113.4 kB view details)

Uploaded CPython 3.12Windows x86-64

moselpy-9.9.1-cp312-cp312-manylinux2014_aarch64.whl (163.9 kB view details)

Uploaded CPython 3.12

moselpy-9.9.1-cp312-cp312-manylinux1_x86_64.whl (174.3 kB view details)

Uploaded CPython 3.12

moselpy-9.9.1-cp312-cp312-macosx_11_0_arm64.whl (142.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

moselpy-9.9.1-cp311-cp311-win_amd64.whl (112.6 kB view details)

Uploaded CPython 3.11Windows x86-64

moselpy-9.9.1-cp311-cp311-manylinux2014_aarch64.whl (166.4 kB view details)

Uploaded CPython 3.11

moselpy-9.9.1-cp311-cp311-manylinux1_x86_64.whl (176.6 kB view details)

Uploaded CPython 3.11

moselpy-9.9.1-cp311-cp311-macosx_11_0_arm64.whl (142.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

moselpy-9.9.1-cp310-cp310-win_amd64.whl (112.4 kB view details)

Uploaded CPython 3.10Windows x86-64

moselpy-9.9.1-cp310-cp310-manylinux2014_aarch64.whl (166.0 kB view details)

Uploaded CPython 3.10

moselpy-9.9.1-cp310-cp310-manylinux1_x86_64.whl (176.1 kB view details)

Uploaded CPython 3.10

moselpy-9.9.1-cp310-cp310-macosx_11_0_arm64.whl (142.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file moselpy-9.9.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: moselpy-9.9.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 113.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for moselpy-9.9.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 24596ac97b519466824c9b7e9b7ace93eb47a65e57677fe3e7382458c8495bce
MD5 722a30d72f3a4b29e999c6a10858d716
BLAKE2b-256 40f528b9be841255a13de8c43611302aa19b02cbfb224e6ba75d7e901a361ce2

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp314-cp314-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp314-cp314-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8bd2d0db16cd9da6a938985154c8888104b377e4fc6c8fa060727b2887246f90
MD5 8e78d29e198ced1dc499cd5b0cff9c8f
BLAKE2b-256 545f9f2fde09c80f59639ecd013b2cb6c43eccd6b13570ae11958c50a2202688

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp314-cp314-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp314-cp314-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8411b97050d2aee981a7aa0f0e6ced52c924c54f1b894461a5e98e1622327adf
MD5 dbcfe1cdb839e3e3b4306368f7546006
BLAKE2b-256 5860d052c60c1c5ed637734fd6ed1bbdcb2f257011d9d2cde93508f3f6068dcd

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8791a47d5f700fe292a1fea572221c226db954db936b8ec119d94987fd8d658e
MD5 67bc04a6718d7d164a08a4f94d08c1e1
BLAKE2b-256 62f949c65592a82ce584678face63438f5b699b16b087bb98fb27911a9c53f1f

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: moselpy-9.9.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 113.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for moselpy-9.9.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c960f4567158d3cf1146eabc1a2f49170db466fd66ff7f40862ae9e33e07ef7b
MD5 f1c0b40c157105fdf5aff314439ec276
BLAKE2b-256 2dd10961ecdff6630ff9c3738648f351762bb94981e3837d83abcb9fdee9fd2e

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b8d2c32a343b8cfbef771b387b52d510845ec79b12f99aa8a00b3e23336f79a
MD5 e7357427191e22d01c37c741be0e6bc4
BLAKE2b-256 28b00784f33cdd2e86270e00a44bb31bed67d8dc4052f0b001f536dd30b5c294

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp313-cp313-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp313-cp313-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4edc774e7059f7b2acdbb2b0f98929e696ddb35d3216051f943da3dd7b13c8db
MD5 ab788a627682aeadb1a3b13f015a3b7e
BLAKE2b-256 81a9dcd73d6660ee156998f29b23bb5a10618296f99261814c60fc64e3f12a54

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d0c0724b9125d7ea563a43d19a0a9d07b86b9f1bb7d3a6d2f6769bb52a46b45
MD5 d2a57223241597bb0356dbd5a4363c81
BLAKE2b-256 a449aa04a309e7d29308abd87856b69ef862c8fcf7d5a050dc5193d1e94de0c2

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: moselpy-9.9.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 113.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for moselpy-9.9.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 839d088952723579226d0268cc216e7911696b5e6b65116bb8f2721678166018
MD5 6ce4bcdd517c0801e13ec2fa76e8613f
BLAKE2b-256 13fd2494132cb92f2eb688960f5beea01f5361630db3a0e6ca4baad79f3ef884

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 10ac6b31748b52071e3f8728d6e85867b053f9c1d7ede62c12af6674899acd0b
MD5 d03bb466fe53a108cfda4161ce9cd172
BLAKE2b-256 e73f1bc2c4a962dbf8a6b8dd605a924ddbba552054eba2b4ffec4ae6a610360e

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp312-cp312-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp312-cp312-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5259c1b5acf98271cdb01a1061390dc3c2c5acf78856c61db6818a87ace416c4
MD5 8ea1b457859b42530200dbebd788e2b6
BLAKE2b-256 7fbe3614caee9f2e3bda04667dea957a0b66ed889a3544ed9bf001fd45bbaa5d

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46e1d8ee1dff67876e1848b6f39024fc562bd75321986fcf8cd536df1cfe8be3
MD5 f0b4b70d4ef76a4c8c5d3db16b243cc2
BLAKE2b-256 c7e32be49704a0fa0f58b5a31d2720d806dc1302855bf1a09cc27d0cfcabfbc0

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: moselpy-9.9.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 112.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for moselpy-9.9.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 44c800cb17975a479164c4652e0b5625352c2fc07c38f0f3beb42cb01e63746f
MD5 f40233f5fe48896e3ade640767993616
BLAKE2b-256 5af9fb3db1eddee988881b846829e28dcbf6e45f5616824b41bd355f7c8d358f

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9c32889df4bf9e0ea9b7a9f357b46a399b9a4736e733885b6efa4044b3ff5f41
MD5 75f0523842ee5c6fdcb33a8d9e8ab10c
BLAKE2b-256 a656fb9f735f0135d68fef973ef6082bd6c14f56359b0dc1903ead2dc5419417

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7566ae59f194714f1545d8ad73c39438d95142fc907e0779a5c610cf14c20d8a
MD5 dff985e7c7ee337ac11aa47c1f98514a
BLAKE2b-256 c156e08d4c9cfd9646201845b3c6a945f6fc36de3cd19e75a3265590d1b6a92f

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aaa0cfdb822859b3289006ab578a33e99e9ffa960e487296bf9f5a974c40176a
MD5 90ebd898c99bd0d035d5a87b3514ae85
BLAKE2b-256 46fa8433592b1a7b298596a059a58ade7c6b044d8e6c074b208a8b83d1993786

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: moselpy-9.9.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 112.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for moselpy-9.9.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c10809b33ebd81bade1c5ffab9edb7de018519fbcfb987a10d22413df15bcae2
MD5 28ed7bd4ca8b1714882dee6763a94686
BLAKE2b-256 65a85f6c0df8d447a2c22a6ac6954b355947ef6a90ea5a2f5158f4a8e9cc9d8a

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fed54207fb9c540c1425ca80a7a56e5e7ec62dc4fe1d87559ca2144065a054f7
MD5 deeafe09964aa669aa05b490bfd1b9d3
BLAKE2b-256 7eea500cc06f760b355381a59e6a981261feee32cc0ec57a6d22614a66ce6d84

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4ee783056cddee278cc7a6ab1242b5b1b6d405078218cc2439c95a49dafce243
MD5 e5d9339288362c88103b5e74d2bd6514
BLAKE2b-256 d31253d052ef8dc794817bcdd00b0cd62883691f4f18fa8a378a76aee1ec6e28

See more details on using hashes here.

File details

Details for the file moselpy-9.9.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for moselpy-9.9.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a65f41eeab590a69c7e21f1d147335e7b05036e671907754a5e918b4532bd11
MD5 88f5be8dea26057e1b71d0416b553710
BLAKE2b-256 61e5d65653b3ad2521671d708a0f5ddf88424632112ed470238948f10ef10e8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page