ficomo: a pyomo-like framework for the FICO xpress solver
ficomo is a library that provides a set of tools for using the FICO xpress solver in the same way as pyomo. ficomo supports the following features:
Features
✨ Declarative syntax: ficomo uses a declarative syntax for defining variables, expressions and constraints.
🚀 Native support for FICO xpress: ficomo provides a native interface to the xpress solver.
🔍 Diagnostics: ficomo provides tools for analyzing optimization problems, such as finding infeasible constraints, finding relaxations that will make the problem feasible, "force" solving an infeasible problem, etc.
⛓️ Remote execution: ficomo provides an easy way to run optimization problems on a remote executor node in both sync and async modes.
💾 Save and load: ficomo provides a way to save and load optimization problems and solutions without depending on xpress implementation details.
Usage Example
Here's a basic example of using ficomo to solve a simple optimization problem. The model determines the optimal number of chairs and tables to produce given manufacturing time and storage space constraints, while maximizing profit.
from ficomo.environ import Problem, Remote, SearchFor, Sense, var
USE_REMOTE = False # change to True to use remote execution
REMOTE_URL = None # None runs a local executor and connects to it
# Define decision variables
x1 = var(name="chairs", lb=0) # number of chairs to produce
x2 = var(name="tables", lb=0) # number of tables to produce
# Define objective: maximize profit
# Profit = 20 per chair + 30 per table
objective = 20 * x1 + 30 * x2
# Add constraints
# Resource constraints: time available for manufacturing
# Each chair takes 4 hours, each table takes 6 hours
# Total time available is 48 hours
time_constraint = 4 * x1 + 6 * x2 <= 48
# Storage space constraint:
# Each chair takes 0.2 sq m, each table takes 0.4 sq m
# Available space is 5 sq m
space_constraint = 0.2 * x1 + 0.4 * x2 <= 5.0
# Create the problem
variables = [x1, x2]
constraints = [time_constraint, space_constraint]
problem = Problem(variables, constraints, objective, sense=Sense.maximize)
if USE_REMOTE:
# Solve the problem on a remote executor node
with Remote(REMOTE_URL) as remote:
solution = problem.to(remote).solve(search_for=SearchFor.optimal)
else:
# Solve the problem localy
solution = problem.solve(search_for=SearchFor.optimal)
# Print solution status
print(f"Solve status: {solution.solve_status!r}")
print(f"Solution status: {solution.solution_status!r}")
# Print solution
print(f"Optimal production plan: {solution.value({x1: x1, x2: x2})}")
print(f"Total profit: ${solution.value(objective)}")
# Output:
# Solve status: <SolveStatus.COMPLETED: 3>
# Solution status: <SolutionStatus.OPTIMAL: 1>
# Optimal production plan: {chairs: 12.0, tables: 0.0}
# Total profit: $240.0
# Save the problem to production-problem.fxp
problem.dump("production-problem.fxp")
# Save the solution to solution.fxs
# NOTE: the solution contains the problem
solution.dump("production-plan.fxs")
# Load the problem from production-problem.fxp
# problem = Problem.load("production-problem.fxp")
# Load the solution from solution.fxs
# solution = Solution.load("production-plan.fxs")
Metadata
Release files for ficomo 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ficomo-0.1.2.tar.gz | 29.9 kB | Without provenance | Details for ficomo-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ficomo-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ficomo-0.1.2-py3-none-any.whl |
Total release size: 55.9 kB
Release files / ficomo-0.1.2.tar.gz
| Download URL | ficomo-0.1.2.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89f69609a82b20742ab03c3b0c6eab0212fa7be53157c4e7b712b9190d6da6c7
|
|
BLAKE2b-256 checksum How to use checksums |
684b32872625a21975a46324086cc969b9ee66ac5695c2861dd4e0fab6bf5d25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.8
|
Release files / ficomo-0.1.2-py3-none-any.whl
| Download URL | ficomo-0.1.2-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ca482f13b1c8f3ab203d30926c76fa9f6c258ad466bdfb9529b4bdcc200ff4b
|
|
BLAKE2b-256 checksum How to use checksums |
94f4999263aede2d660aaa27340cc5d2e4109a8362fc2b32965d75fa7efc67fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.8
|
Security for ficomo 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.