-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJobManager.py.orig
90 lines (73 loc) · 2.51 KB
/
JobManager.py.orig
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
__author__ = 'max'
import Job
#aka the GOD file. Ask God for a job, he retuns the next job.
class JobManager:
<<<<<<< HEAD
def __init__(self, kLookAhead, inputFile, numberOfMachines):
self.numberOfMachines = numberOfMachines
self.readFile = open(inputFile, 'r')
self.jobs = []
self.lookAhead = kLookAhead
self.sumJobTime = 0.0
line = self.readFile.readline()
self.jobs = self.readFile.readlines()
self.readFile.close()
for i in range(len(self.jobs)):
self.jobs[i] = Job.Job(int(self.jobs[i].replace('\n', '')), self.numberOfMachines)
self.sumJobTime += float(self.jobs[i])
self.MAXJOB = Job.Job(0, self.numberOfMachines)
def __str__(self):
output = ""
for each in self.jobs:
output += ", " + str(each)
return str(output)
def __iter__(self):
for i in range(len(self.jobs)):
work = []
futureWork = []
work.append(self.jobs[i])
futureWork.append(self.jobs[i + 1:i + 1 + self.lookAhead])
yield work[0], futureWork[0]
def __getitem__(self, item):
return int(self.jobs[item])
=======
def __init__(self, kLookAhead, inputFile, numberOfMachines):
self.numberOfMachines = numberOfMachines
self.readFile = open(inputFile, 'r')
self.jobs = []
self.lookAhead = kLookAhead
self.sumJobTime = 0.0
line = self.readFile.readline()
self.jobs = self.readFile.readlines()
self.readFile.close()
for i in range(len(self.jobs)):
self.jobs[i] = Job.Job(int(self.jobs[i].replace('\n', '')), self.numberOfMachines)
self.sumJobTime += float(self.jobs[i])
self.MAXJOB = Job.Job(0, self.numberOfMachines)
# def __init__(self, kLookAhead, inputArray, numberOfMachines):
# self.numberOfMachines = numberOfMachines
# self.jobs = inputArray
#
# self.lookAhead = kLookAhead
# self.sumJobTime = 0.0
#
# for i in range(len(self.jobs)):
# self.jobs[i] = Job.Job(self.jobs[i], self.numberOfMachines)
# self.sumJobTime += float(self.jobs[i])
#
# self.MAXJOB = Job.Job(0, self.numberOfMachines)
def __str__(self):
output = ""
for each in self.jobs:
output += ", " + str(each)
return str(output)
def __iter__(self):
for i in range(len(self.jobs)):
work = []
futureWork = []
work.append(self.jobs[i])
futureWork.append(self.jobs[i + 1:i + 1 + self.lookAhead])
yield work[0], futureWork[0]
def __getitem__(self, item):
return int(self.jobs[item])
>>>>>>> 95208e35333f8a30144d1f80f3cce154d8cd7d3e