capacity | cost | ||
---|---|---|---|
source | target | ||
0 | 1 | 2 | 9 |
2 | 2 | 7 | |
1 | 3 | 1 | 1 |
2 | 3 | 1 | 10 |
4 | 2 | 6 | |
3 | 5 | 2 | 1 |
4 | 5 | 2 | 1 |
Painless Optimization Templates
EURO 2024, Copenhagen
You should be proficient in:
enter Gurobi OptiMods!
… unfortunately not
Simplicity comes at the price of flexibility!
Installation via PyPI:
Documentation on your selected Mod:
https://gurobi-optimods.readthedocs.io
Bring your data into the required format and run the Mod
Documentation is a major part of the project
from gurobi_optimods import datasets
edge_data, node_data = datasets.simple_graph_pandas()
edge_data
node_data
capacity | cost | ||
---|---|---|---|
source | target | ||
0 | 1 | 2 | 9 |
2 | 2 | 7 | |
1 | 3 | 1 | 1 |
2 | 3 | 1 | 10 |
4 | 2 | 6 | |
3 | 5 | 2 | 1 |
4 | 5 | 2 | 1 |
demand | |
---|---|
0 | -2 |
1 | 0 |
2 | -1 |
3 | 1 |
4 | 0 |
5 | 2 |
from gurobi_optimods import datasets
from gurobi_optimods.min_cost_flow import min_cost_flow_pandas
edge_data, node_data = datasets.simple_graph_pandas()
obj, sol = min_cost_flow_pandas(edge_data, node_data, verbose=False)
obj
sol
31.0
source target
0 1 1.0
2 1.0
1 3 1.0
2 3 0.0
4 2.0
3 5 0.0
4 5 2.0
Name: flow, dtype: float64
from gurobi_optimods import datasets
node_data, edge_data, line_data, linepath_data, demand_data = (
datasets.load_siouxfalls_network_data()
)
frequencies = [1,3]
from gurobi_optimods import datasets
node_data, edge_data, line_data, linepath_data, demand_data = (
datasets.load_siouxfalls_network_data()
)
frequencies = [1,3]
from gurobi_optimods import datasets
node_data, edge_data, line_data, linepath_data, demand_data = (
datasets.load_siouxfalls_network_data()
)
frequencies = [1,3]
from gurobi_optimods import datasets
node_data, edge_data, line_data, linepath_data, demand_data = (
datasets.load_siouxfalls_network_data()
)
frequencies = [1,3]
from gurobi_optimods import datasets
from gurobi_optimods.line_optimization import line_optimization
node_data, edge_data, line_data, linepath_data, demand_data = (
datasets.load_siouxfalls_network_data()
)
frequencies = [1,3]
obj_cost, final_lines = line_optimization(
node_data,
edge_data,
line_data,
linepath_data,
demand_data,
frequencies,
verbose=False,
)
obj_cost
211.0
Get involved and share your feedback and ideas!
©️ Gurobi Optimization
gurobi.github.io/slides/