Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 26.1.8.3 instead.
Reason given by maintainers: old

AIMMS Python library

This is a BETA version of the AIMMS Python library. Any feedback, bug reports, or feature requests are welcome.

With this library its possible to interact with AIMMS models from Python.

Features

  • Seamless integration with AIMMS models from Python
  • Assign and retrieve data using Python dicts, Pandas, Polars, or Arrow tables
  • Execute AIMMS procedures and retrieve results programmatically
  • Built with pybind11 for high-performance C++ integration
  • Flexible data return types for different workflows

Getting Started

To use the AIMMS Python library, you need to have an AIMMS developer version installed (see https://www.aimms.com/support/downloads/), a valid license (see https://licensing.cloud.aimms.com/license) and an already existing AIMMS project. Below is a step-by-step example of how to use the library to solve a simple transportation optimization problem.

Step 1: Initialize the AIMMS Project

First, initialize the AIMMS project by specifying the AIMMS executable path, project path, and other configurations.

Note: Ensure that the aimms_path points to a valid AIMMS Bin (or Lib on linux) folder of an installed AIMMS version. You use can the utility function find_aimms_path to automatically search your system for that path.

import os
from aimms.project.project import Project 
from aimms.utils import find_aimms_path

# Initialize the AIMMS project
my_aimms = Project(
    # path to the AIMMS Bin folder (on linux the Lib folder)
    aimms_path=find_aimms_path("25.4.3.3"),

    # path to the AIMMS project
    aimms_project_file=R"C:\AimmsProjects\MyAimmsProject\MyAimmsProject.aimms",

    # url
    license_url=R"wss://licensing.aimms.cloud/license-ws/license?profile=community&license=12345678-90ab-cdef-1234-567890abcdef"
)

Step 2: Assign Data to Parameters

This is an example of assigning data to parameters with Pandas DataFrames.

demand_df = pd.DataFrame({
    "c": ["Houston", "Phoenix", "Philadelphia"],
    "demand": [50.0, 60.0, 40.0]
})

supply_df = pd.DataFrame(data={
    "w": ["NewYork", "LosAngeles", "Chicago"],
    "supply": [70.0, 80.0, 60.0]
})

unit_transport_cost_df = pd.DataFrame({
    "w": ["NewYork", "NewYork", "NewYork", "LosAngeles", "LosAngeles", "LosAngeles", "Chicago", "Chicago", "Chicago"],
    "c": ["Houston", "Phoenix", "Philadelphia", "Houston", "Phoenix", "Philadelphia", "Houston", "Phoenix", "Philadelphia"],
    "unit_transport_cost": [5.0, 6.0, 4.0, 3.0, 2.0, 7.0, 4.0, 5.0, 3.0]
})

my_aimms.demand.assign( demand_df)
my_aimms.supply.assign( supply_df)
my_aimms.unit_transport_cost.assign( unit_transport_cost_df)

You can assign doubles, integers, strings to AIMMS parameters. The library will automatically convert the data types to the appropriate AIMMS types. The sets will be filled automatically based on the data you assign to the parameters.

Step 3: Execute the Optimization Procedure

It is possible in AIMMS to define procedures that encapsulate the logic of your optimization model. These procedures can be executed from Python using the AIMMS Python library. In this example we run the main procedure in the AIMMS project to solve the optimization problem.

my_aimms.MainExecution()

It is also possible to run procedures with arguments for example:

my_aimms.run_procedure(test1=5.0, test2=10.0, test3="hello")

Make sure the order of the arguments is correct, as well as the types.

Step 4: Retrieve and Display Results

Retrieve the results of the optimization, such as the total transport cost and the transport plan.

# Retrieve results
print(f"Total Transport Cost: {my_aimms.total_transport_cost.data()}")
print(f"Transport Plan: {my_aimms.transport.data()}")

The .data() function is used to fetch the current value of an AIMMS identifier (e.g., a parameter, variable, or set) into Python. This function is efficient and only fetches data if it has changed since the last fetch.

Data Types Returned by .data()

depending on the data_type_preference you set in the Project constructor, the .data() function will return different types of Python objects:

Sets always return a list of strings.

For parameters and variables, .data() can return:

  • A scalar value (e.g., float or int or string) if the parameter or variable is scalar.
  • A dictionary where the keys are tuples of strings (representing indices) and the values are float, int, string.
  • A Arrow Table or Pandas or Polars DataFrame depending on the data_type_preference set in the Project constructor.

Example Output

Depending on you return type preference the python object returned from the .data() function will be different, the output for dictionaries can look like this:

Total Transport Cost: 150.0
Transport: {("NewYork", "Houston"): 30, ("LosAngeles", "Phoenix"): 50, ...}

for Pandas DataFrames can look like this:

Total Transport Cost: 150.0
Transport:
        w               c               transport
    0   NewYork         Houston         30
    1   LosAngeles      Phoenix         50
    2   Chicago         Philadelphia    40
    3   NewYork         Philadelphia    20

extra

it is possible to generate a stub file for your project which can greatly help with autocompletion in your IDE. This stub file contains all the identifiers in your AIMMS project and their types. You can generate this stub file by running the following command:

my_aimms.generate_stub_file( "my_project_stub.py" )

To use this stub file you can the following to the top of your python script:

from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from my_project_stub import Project

License

This project is licensed under the MIT License.

Support

For questions, bug reports, or feature requests, please contact AIMMS B.V. via support. Or post an question on the AIMMS Community. We are happy to help you with any issues or questions you may have.

Metadata

Release files for aimmspy 1.0.1.post52

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for aimmspy 1.0.1.post52
File
aimmspy-1.0.1.post52-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
aimmspy-1.0.1.post52-cp313-cp313-manylinux_2_27_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64 Details
aimmspy-1.0.1.post52-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
aimmspy-1.0.1.post52-cp312-cp312-manylinux_2_27_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64 Details
aimmspy-1.0.1.post52-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
aimmspy-1.0.1.post52-cp311-cp311-manylinux_2_27_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64 Details
aimmspy-1.0.1.post52-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
aimmspy-1.0.1.post52-cp310-cp310-manylinux_2_27_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64 Details

Total release size: 5.1 MB

Release files / aimmspy-1.0.1.post52-cp313-cp313-win_amd64.whl

Download URL aimmspy-1.0.1.post52-cp313-cp313-win_amd64.whl
Size 563.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
eb2c7ea649b2f6f54ba371cb46737a9467f91e659af71c4eb470b5036290c359
BLAKE2b-256 checksum
How to use checksums
7c969d6a3aef5450e96e4f533604cbc7419b07ff0c4c8c013ddda2f9eef1e2f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp313-cp313-manylinux_2_27_x86_64.whl

Download URL aimmspy-1.0.1.post52-cp313-cp313-manylinux_2_27_x86_64.whl
Size 718.6 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
97504fcb53a4eb21b6532aca5563d6fb57955c3aa810e02dd226607f14fcc685
BLAKE2b-256 checksum
How to use checksums
05f87ab706bcb5ab4195ae0208ec347b60ece982414105e18055bebbad1a46af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp312-cp312-win_amd64.whl

Download URL aimmspy-1.0.1.post52-cp312-cp312-win_amd64.whl
Size 563.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
a66697f69b2a175d042fc3b3ff8398120b8d335ce528c42b705919154efbfeb4
BLAKE2b-256 checksum
How to use checksums
e2fba7d868fecf864a3b9fa78c32be0846598a7f33eccebc56220f11ca4f465d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp312-cp312-manylinux_2_27_x86_64.whl

Download URL aimmspy-1.0.1.post52-cp312-cp312-manylinux_2_27_x86_64.whl
Size 718.2 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
826e838015b672bc74269883ea6e100c79251a20a5fd87ea6ddb62fdcb17591f
BLAKE2b-256 checksum
How to use checksums
368d3bcf090a2ec374516375e886a1aa048a23a08da0917a58903103b0d8b561
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp311-cp311-win_amd64.whl

Download URL aimmspy-1.0.1.post52-cp311-cp311-win_amd64.whl
Size 562.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bceeb0f96af7600f844a20f6c7785189b50732b5ed8d94433d800abf1951b14f
BLAKE2b-256 checksum
How to use checksums
039220acb8bd6fc959229a89429446ed891ed244643f18f588e33eee7263ab40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp311-cp311-manylinux_2_27_x86_64.whl

Download URL aimmspy-1.0.1.post52-cp311-cp311-manylinux_2_27_x86_64.whl
Size 717.7 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
2b2c85029a8fedee27d7f911142b96b154922b3e3b395dba1cc6d511f8cef676
BLAKE2b-256 checksum
How to use checksums
cc3d5618bf730a222deee1b2e9cf03648d59492d2aa8c42874cbc869cea94537
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp310-cp310-win_amd64.whl

Download URL aimmspy-1.0.1.post52-cp310-cp310-win_amd64.whl
Size 561.5 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
c7471966a915ec1064c34b25441abce5ddc2c04bb147f8745ed2c04b62f2aa65
BLAKE2b-256 checksum
How to use checksums
ce0bf3a1f7df192cba4e75072f6296aaf73c6229d9d8deecc6981974a96513b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / aimmspy-1.0.1.post52-cp310-cp310-manylinux_2_27_x86_64.whl

Download URL aimmspy-1.0.1.post52-cp310-cp310-manylinux_2_27_x86_64.whl
Size 716.7 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64
SHA-256 checksum
How to use checksums
6c9747730f23625002c9ec2b143647818dd748c7042c6fca238868a7f028daae
BLAKE2b-256 checksum
How to use checksums
96116e2b080b386e817eacedafb9984b76303bb1141a3faa5e691567e55a25aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

1.0.1.post52 This release

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page