-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
25 lines (23 loc) · 1013 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import networkx as nx
from matplotlib import pyplot as plt
from algorithm import solve
from algorithm.outputting import print_flow
from algorithm.solving import find_optimal_flow, split_sources_and_time_expand
from benchmarking import run_and_display
from instances import basic_instance, ieee14, ieee118, problem5_instance
# DEMO CODE, REPLACE WITH YOUR OWN
# --------------------------------
solve(ieee14(kV=345), verbosity=2)
solve(ieee118(), verbosity=2)
try:
solve(ieee14(kV=-2), verbosity=2)
except AttributeError:
pass
solve(basic_instance(), verbosity=3)
print(problem5_instance())
nx.draw_networkx(problem5_instance()); plt.show()
nx.draw_networkx(split_sources_and_time_expand(problem5_instance())); plt.show()
print_flow(*find_optimal_flow(split_sources_and_time_expand(problem5_instance())), merged=False)
run_and_display(graph_type="circular ladder", max_nodes=101, num_runs=1)
run_and_display(graph_type="circular ladder", max_nodes=22, overwrite=False)
# --------------------------------