-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex_prioritization.py
49 lines (33 loc) · 1.16 KB
/
ex_prioritization.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import datetime
import networkx
from src.sched_sim import sched_sim
from src.scheduling_viewer import make_scheduling_view
from src.make_dag import make_template_dag
from src.make_dag import make_template_dag2
from src.make_dag import make_random_dag
### DAG定義
# 課題1のDAG
G, target_makespan = make_template_dag()
# 課題2のDAG
G, target_makespan = make_template_dag2()
# ランダムDAG生成(引数はシード値)
#G, target_makespan = make_random_dag(123)
### 実行順序決定
order = [o for o in range(len(G.nodes))]
# ここに実行順序を書く(課題部分)
#order = []
# 実行順序確認
print('order:\t\t'+str(order))
### 以下は触らない
# スケジューリング
filename = 'output/scheduling_result_'+datetime.datetime.today().strftime('%m%d%H%M')
makespan = sched_sim(G, order, filename)
# makespan出力
print('makespan:\t'+str(makespan))
if target_makespan != 0:
if makespan <= target_makespan:
print('result:\t\t'+'\033[32m'+'Succeed!'+'\033[0m')
else:
print('result:\t\t'+'\033[31m'+'Failed...'+'\033[0m')
# HTML出力
make_scheduling_view(filename)