AerOptimPy
AerOptimPy is an early-stage Python package for fleet-aware airline route-network and flight-frequency optimization.
The package uses the free, open-source HiGHS optimizer by default through
scipy.optimize.milp. Gurobi remains available as an optional backend for users with an
appropriate Gurobi license.
The first model answers this planning question:
Given passenger demand, fares, aircraft capacity, fleet availability, airport slots, aircraft range, and operating costs, which direct routes should an airline operate and how frequently should it fly them?
Documentation
Full guides for GitHub readers:
- User guide — what to input, how to solve, how to read results & maps
- API reference — classes, parameters, and return fields
- Docs index
Installation
pip install aeroptimpy
No solver license is required for the default HiGHS backend.
Optional Gurobi support:
pip install "aeroptimpy[gurobi]"
Optional interactive maps:
pip install "aeroptimpy[viz]"
Requires Python 3.10+.
What users provide
You supply three ingredients:
- Airports — codes, coordinates, optional slot limits
- Fleet — aircraft types with seats, counts, range, speed, and block-hour cost
- Demand — directed markets with passengers and average fares
Then AerOptimPy returns an optimized frequency plan (which routes, which aircraft, how many flights).
Minimal example
from aeroptimpy import Aircraft, Airport, Demand, RouteNetwork, RouteOptimizer
airports = [
Airport("DTW", 42.2162, -83.3554, slot_limit=40),
Airport("ATL", 33.6407, -84.4277, slot_limit=50),
]
fleet = [
Aircraft(
name="A320",
capacity=180,
count=2,
range_km=6100,
cruise_speed_kmh=830,
cost_per_block_hour=6500,
)
]
demand = [
Demand("DTW", "ATL", passengers=240, average_fare=210),
Demand("ATL", "DTW", passengers=220, average_fare=205),
]
network = RouteNetwork(airports=airports, aircraft=fleet, demand=demand)
optimizer = RouteOptimizer(network) # solver="highs" is the default
result = optimizer.solve(planning_days=1, max_flights_per_leg=5)
print(result.summary())
for route in result.routes:
print(route)
Select Gurobi explicitly when it is installed and licensed:
optimizer = RouteOptimizer(network, solver="gurobi")
Visualize optimal routes
from aeroptimpy.viz import plot_routes
fmap = plot_routes(
network,
result,
theme="midnight",
weight_by="flights",
rank_by="contribution", # value ranking, not flight order
animate=True,
)
fmap.save("optimal_routes.html")
On the map:
- Airplane icon (top-left, under zoom) — filter by aircraft type
- Route inspector (bottom-right) — tap a route to read details at your pace
- Play / Pause — optional slow ranked tour
Run the map example with:
python examples/plot_optimal_routes.py
Current scope
- Validated airport, aircraft, and passenger-demand data models
- Great-circle distance and aircraft-range feasibility checks
- Solver-independent mixed-integer route activation and frequency model
- Free HiGHS backend enabled by default; optional Gurobi backend
- Passenger demand, seat capacity, fleet hours, slots, and flow-balance constraints
- Optional carbon-price penalty
- Structured results and interactive Folium maps
- Synthetic multi-airport examples
Development install
git clone https://github.com/GodsentIzzy123/aeroptimpy.git
cd aeroptimpy
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev,viz]"
pytest
Run the basic optimizer example:
python examples/basic_route_optimization.py
Model summary
For airport pair (i, j) and aircraft type k, the model uses:
activate[i,j,k]: binary route-aircraft activation variableflights[i,j,k]: integer number of flightsserved[i,j]: passengers carried
The objective maximizes passenger revenue minus flight operating cost and an optional carbon-price penalty.
Map rankings by contribution show economic priority, not a single-aircraft itinerary.
Research roadmap
- Add BTS T-100 and DB1C data ingestion.
- Add demand forecasting and scenario generation.
- Compare deterministic, stochastic, robust, and chance-constrained models.
- Add emissions and reliability Pareto-front analysis.
- Benchmark HiGHS and Gurobi on increasingly large route networks.
- Publish benchmark instances and reproducible computational experiments.
Citation
If you use AerOptimPy in academic work, please cite it (see CITATION.cff).
License
MIT
Metadata
Release files for aeroptimpy 0.3.1
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 | |
|---|---|---|---|---|
| aeroptimpy-0.3.1.tar.gz | 31.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aeroptimpy-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.1 kB
Release files / aeroptimpy-0.3.1.tar.gz
| Download URL | aeroptimpy-0.3.1.tar.gz |
|---|---|
| Size | 31.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b13f64f5964e05109ef7f9681ff328e4dea3324c6571c23644756f880709ff0a
|
|
BLAKE2b-256 checksum How to use checksums |
2cd5d26e237bc9fcc0144ae6df8cab429321ef74c342b56f54a16ed8dd7cf0a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / aeroptimpy-0.3.1-py3-none-any.whl
| Download URL | aeroptimpy-0.3.1-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a580e29c10d637accbcc83a9ad4673a4bcf0785c16ded9037ae07c525448824e
|
|
BLAKE2b-256 checksum How to use checksums |
1a8ae7d14a0f09e1570ca8e2e3fa1ca1d11cb1b60f217c99d8a11fed4bfb7aa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for aeroptimpy 0.3.1
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.