Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d1b0866

Browse files
cleanup (remove jobsForMachine except for comments)
1 parent 7ac8182 commit d1b0866

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎LoadBalancing.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ public class LoadBalancing {
44
public void balanceMachines(int machineCount, int[][] jobs){
55
Arrays.sort(jobs, (a, b) -> -Integer.compare(a[1], b[1])); //Sort by longest processing time 1st
66

7-
ArrayList<ArrayList<ArrayList<Integer>>> jobsForMachine = new ArrayList<ArrayList<ArrayList<Integer>>>();
7+
// ArrayList<ArrayList<ArrayList<Integer>>> jobsForMachine = new ArrayList<ArrayList<ArrayList<Integer>>>();
88
PriorityQueue<Machine> loads = new PriorityQueue<Machine>();
99
for(int i=0; i<machineCount; i++){
1010
loads.add(new Machine(i));
11-
jobsForMachine.add(new ArrayList<ArrayList<Integer>>());
11+
// jobsForMachine.add(new ArrayList<ArrayList<Integer>>());
1212
}
1313

1414
for(int j=0; j<jobs.length; j++){
1515
Machine smallestLoadMachine = loads.remove();
16-
int i=smallestLoadMachine.getId();
16+
int jobId=jobs[j][0];
1717
int jobProcessingTime = jobs[j][1];
18-
jobsForMachine.get(i).add(new ArrayList<Integer>(Arrays.asList(jobs[j][0], jobProcessingTime)) );
18+
// int i=smallestLoadMachine.getId();
19+
// jobsForMachine.get(i).add(new ArrayList<Integer>(Arrays.asList(jobs[j][0], jobProcessingTime)) );
20+
21+
System.out.println(smallestLoadMachine);
1922

20-
int jobId=jobs[j][0];
2123
smallestLoadMachine.addJob(jobId, jobProcessingTime);
22-
23-
System.out.println(smallestLoadMachine);
2424

2525
smallestLoadMachine.setCurrentLoad(smallestLoadMachine.getCurrentLoad() + jobProcessingTime);
2626
loads.add(smallestLoadMachine); //Adding machine back does increaseKey
2727

28-
System.out.println(smallestLoadMachine+"\n");
28+
System.out.println(smallestLoadMachine+"\n");
2929
}
3030

3131
int makespan = 0;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /