Skip to content

Commit

Permalink
Dumb oversight in MH recomputation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rojods committed Nov 27, 2023
1 parent 80e32f7 commit 223a4a6
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ default double[] recomputeMaximumCycles(
}
}
}
// System.out.println(
// "mappings is %s and weights is %s and edges are
// ".formatted(Arrays.toString(mapping),
// Arrays.toString(jobWeights), Arrays.toString(edgeWeigths)));
var mergedGraph = new AsGraphUnion<>(follows, mappingGraph);
var maxCycles = new double[jobWeights.length];
System.arraycopy(jobWeights, 0, maxCycles, 0, jobWeights.length);
Expand All @@ -46,20 +50,22 @@ default double[] recomputeMaximumCycles(
}
}
}
// System.out.println("scc %s has %f".formatted(scc.toString(), cycleValue));
for (var jobI : scc) {
maxCycles[jobI] = Math.max(maxCycles[jobI], cycleValue);
}
});
// System.out.println("A maxCycles: " + Arrays.toString(maxCycles));
var mappedInspector = new ConnectivityInspector<>(mergedGraph);
mappedInspector.connectedSets().forEach(wcc -> {
// System.out.println("wcc: " + wcc);
wcc.stream().mapToDouble(jobI -> jobWeights[jobI]).max().ifPresent(maxValue -> {
wcc.stream().mapToDouble(jobI -> maxCycles[jobI]).max().ifPresent(maxValue -> {
for (var jobI : wcc) {
maxCycles[jobI] = maxValue;
}
});
});
// System.out.println("maxCycles: " + Arrays.toString(maxCycles));
// System.out.println("B maxCycles: " + Arrays.toString(maxCycles));
return maxCycles;
}

Expand Down
Loading

0 comments on commit 223a4a6

Please sign in to comment.