# Minimum cost flow problem with multiple arcs between nodes in Python / Google OR

Is it possible to work with multiple arcs between 2 nodes within Google OR?

Or are there better modeling techniques?

I want to optimize flow from supply to demand areas, where supply and demand are constraints on node level (each node has 1 supply/demand that the arcs can use/fulfill).

# Application to liner shipping

# Instantiate a SimpleMinCostFlow solver. min_cost_flow = pywrapgraph.SimpleMinCostFlow()

# Define four parallel arrays: sources, destinations, capacities,
# and unit costs between each pair.
# start_nodes and end_nodes contain list of edges between nodes (both arrays have same length) start_nodes = [1, 1, 1, 2, 2] end_nodes = [2, 2, 3, 3, 3] capacities = [70, 50, 90, 60, 40] unit_costs = [100, 100, 100, 100, 100]

# Define an array of supplies at each node. supplies = [500, 0, -500]

# Add each arc. for arc in zip(start_nodes, end_nodes, capacities, unit_costs):
arc)

# Add node supply. for count, supply in enumerate(supplies):
min_cost_flow.SetNodeSupply(count, supply)

# Find the min cost flow. status = min_cost_flow.Solve()

if status != min_cost_flow.OPTIMAL:
print('There was an issue with the min cost flow input.')
print(f'Status: {status}')
exit(1) print('Minimum cost: ', min_cost_flow.OptimalCost()) print('') print(' Arc   Flow / Capacity  Cost') for i in range(min_cost_flow.NumArcs()):
cost = min_cost_flow.Flow(i) * min_cost_flow.UnitCost(i)
print('%1s -> %1s    %3s   / %3s   %3s' %