-
Notifications
You must be signed in to change notification settings - Fork 0
/
NataliaMain.py
50 lines (41 loc) · 1.84 KB
/
NataliaMain.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
50
__author__ = 'max'
import MachineBoss
import JobManager
import GreedyScheduler
import SortedGreedyScheduler
import RandomScheduler
def main():
k=3
"""
for m in range(2,4):
jobs = JobManager.JobManager(k,'testFile.txt')
machines = MachineBoss.MachineBoss(m)
GreedyScheduler.GreedyScheduler(machines,jobs)
makeSpan = machines.maxMachine().makeSpan
#print "Max Machine Run time: "+ str(makeSpan) + " OPT for " + str(m) + " machines is " + str(ratio)
#print "ratio: " + str(makeSpan/ratio)
LB = max(jobs.sumJobTime/m,max(jobs.jobs))
print "LB = "+str(LB)
print "Best: m= "+ str(m) + " Greedy makespan: " + str(makeSpan) + " ratio: " + str(makeSpan/LB)
for m in range(2,4):
jobs = JobManager.JobManager(k,'testFile.txt')
machines = MachineBoss.MachineBoss(m)
SortedGreedyScheduler.SortedGreedyScheduler(machines,jobs)
makeSpan = machines.maxMachine().makeSpan
#print "Max Machine Run time: "+ str(makeSpan) + " OPT for " + str(m) + " machines is " + str(ratio)
#print "ratio: " + str(makeSpan/ratio)
print "Best: m= "+ str(m) + " SortedGreedy makespan: " + str(makeSpan) + " ratio: " + str(makeSpan/LB)
for m in machines:
print str(m.getJobs())
"""
for m in range(2,8):
jobs = JobManager.JobManager(k,'input1.txt',m)
machines = MachineBoss.MachineBoss(m)
RandomScheduler.RandomScheduler(machines,jobs)
makeSpan = machines.maxMachine().makeSpan
#print "Max Machine Run time: "+ str(makeSpan) + " OPT for " + str(m) + " machines is " + str(ratio)
#print "ratio: " + str(makeSpan/ratio)
LB = max(jobs.sumJobTime/m,max(jobs.jobs))
print "LB = "+str(LB)
print "Best: m= "+ str(m) + " Greedy makespan: " + str(makeSpan) + " ratio: " + str(makeSpan/LB)
main()