Commit f102241f authored by Sebastian Vollbrecht's avatar Sebastian Vollbrecht

More code movements.

parent d2e0cbd7
...@@ -119,7 +119,4 @@ public abstract class Property implements Observer<Edge<ResourceNode>>, Initiali ...@@ -119,7 +119,4 @@ public abstract class Property implements Observer<Edge<ResourceNode>>, Initiali
this.rng = rng; this.rng = rng;
} }
@Override
public abstract void reset();
} }
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package graphgen.generator.components.properties.infeasibleMinII; package graphgen.generator.components.properties.infeasibleMinII;
import graphgen.datastructures.SeededRandom; import graphgen.datastructures.SeededRandom;
import graphgen.generator.components.Initializable;
import graphgen.generator.components.properties.infeasibleMinII.configuration.InfeasibleConfiguration; import graphgen.generator.components.properties.infeasibleMinII.configuration.InfeasibleConfiguration;
import graphgen.generator.components.properties.infeasibleMinII.configuration.StartConfiguration; import graphgen.generator.components.properties.infeasibleMinII.configuration.StartConfiguration;
import graphgen.generator.components.properties.infeasibleMinII.configuration.SuffixConfiguration; import graphgen.generator.components.properties.infeasibleMinII.configuration.SuffixConfiguration;
...@@ -40,19 +39,19 @@ import java.util.function.BiFunction; ...@@ -40,19 +39,19 @@ import java.util.function.BiFunction;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class InfeasibleEdgePlanner implements Initializable { public class InfeasibleEdgePlanner {
private final StartConfiguration startCfg; private final StartConfiguration startCfg;
private final InfeasibleConfiguration infeasibleCfg; private final InfeasibleConfiguration infeasibleCfg;
private final SuffixConfiguration suffixCfg; private final SuffixConfiguration suffixCfg;
private final SeededRandom rng;
private SeededRandom rng;
public InfeasibleEdgePlanner(StartConfiguration startCfg, InfeasibleConfiguration infeasibleCfg, public InfeasibleEdgePlanner(StartConfiguration startCfg, InfeasibleConfiguration infeasibleCfg,
SuffixConfiguration suffixCfg) { SuffixConfiguration suffixCfg, SeededRandom rng) {
this.startCfg = startCfg; this.startCfg = startCfg;
this.infeasibleCfg = infeasibleCfg; this.infeasibleCfg = infeasibleCfg;
this.suffixCfg = suffixCfg; this.suffixCfg = suffixCfg;
this.rng = rng;
} }
public Set<Integer> getProblematicTimeslots() { public Set<Integer> getProblematicTimeslots() {
...@@ -382,16 +381,6 @@ public class InfeasibleEdgePlanner implements Initializable { ...@@ -382,16 +381,6 @@ public class InfeasibleEdgePlanner implements Initializable {
} }
@Override
public void init(SeededRandom rng) {
this.rng = rng;
}
@Override
public void reset() {
// Do nothing.
}
public static Map<ResourceNode, PlannedEdge> getIncomingEdgesMap(Set<PlannedEdge> edges, public static Map<ResourceNode, PlannedEdge> getIncomingEdgesMap(Set<PlannedEdge> edges,
Collection<ResourceNode> relevantNodes) { Collection<ResourceNode> relevantNodes) {
Map<ResourceNode, PlannedEdge> incomingEdgesByNode = new HashMap<>(); Map<ResourceNode, PlannedEdge> incomingEdgesByNode = new HashMap<>();
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package graphgen.generator.components.properties.infeasibleMinII; package graphgen.generator.components.properties.infeasibleMinII;
import graphgen.datastructures.SeededRandom; import graphgen.datastructures.SeededRandom;
import graphgen.generator.components.Initializable;
import graphgen.generator.components.properties.infeasibleMinII.configuration.InfeasibleConfiguration; import graphgen.generator.components.properties.infeasibleMinII.configuration.InfeasibleConfiguration;
import graphgen.generator.components.properties.infeasibleMinII.configuration.StartConfiguration; import graphgen.generator.components.properties.infeasibleMinII.configuration.StartConfiguration;
import graphgen.graph.LayerStructure; import graphgen.graph.LayerStructure;
...@@ -31,21 +30,21 @@ import java.util.Objects; ...@@ -31,21 +30,21 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
public class InfeasibleNodePlacer implements Initializable { public class InfeasibleNodePlacer {
private final StartConfiguration startCfg; private final StartConfiguration startCfg;
private final InfeasibleConfiguration infeasibleCfg; private final InfeasibleConfiguration infeasibleCfg;
private final SeededRandom rng;
private SeededRandom rng; public InfeasibleNodePlacer(StartConfiguration startCfg, InfeasibleConfiguration infeasibleCfg, SeededRandom rng) {
public InfeasibleNodePlacer(StartConfiguration startCfg, InfeasibleConfiguration infeasibleCfg) {
this.startCfg = startCfg; this.startCfg = startCfg;
this.infeasibleCfg = infeasibleCfg; this.infeasibleCfg = infeasibleCfg;
this.rng = rng;
} }
public Set<Integer> getPossibleLayers(ResourceNode problematicNode) { public Set<Integer> getPossibleLayers(ResourceNode problematicNode) {
if (!infeasibleCfg.getProblematicNodes().contains(problematicNode)) { if (!infeasibleCfg.getProblematicNodes().contains(Objects.requireNonNull(problematicNode))) {
throw new IllegalArgumentException("Node " + problematicNode + " is not problematic."); throw new IllegalArgumentException("Node " + problematicNode + " is not problematic.");
} else if (infeasibleCfg.getFixedNodes().contains(problematicNode)) { } else if (infeasibleCfg.getFixedNodes().contains(problematicNode)) {
throw new IllegalArgumentException("Node " + problematicNode + " has been fixed already."); throw new IllegalArgumentException("Node " + problematicNode + " has been fixed already.");
...@@ -56,7 +55,7 @@ public class InfeasibleNodePlacer implements Initializable { ...@@ -56,7 +55,7 @@ public class InfeasibleNodePlacer implements Initializable {
Set<Integer> possibleLayers = new HashSet<>(); Set<Integer> possibleLayers = new HashSet<>();
LayerStructure layers = infeasibleCfg.getLayers(); LayerStructure layers = infeasibleCfg.getLayers();
if (Objects.requireNonNull(problematicNode).getDelay() == 0) { if (problematicNode.getDelay() == 0) {
remainingZeroNodes--; remainingZeroNodes--;
} }
...@@ -155,11 +154,14 @@ public class InfeasibleNodePlacer implements Initializable { ...@@ -155,11 +154,14 @@ public class InfeasibleNodePlacer implements Initializable {
if (possibleLayers.isEmpty()) { if (possibleLayers.isEmpty()) {
throw new IllegalArgumentException("Possible layers must be non-empty."); throw new IllegalArgumentException("Possible layers must be non-empty.");
} else if (possibleLayers.stream().anyMatch(l -> l <= startCfg.getDestinationNodeLayer())) { } else if (problematicNode != startCfg.getDestinationNode()) {
throw new IllegalArgumentException("Possible layers must be greater than the destination node's layer."); if (possibleLayers.stream().anyMatch(l -> l <= startCfg.getDestinationNodeLayer())) {
throw new IllegalArgumentException(
"Possible layers must be greater than the destination node's layer.");
} else if (!infeasibleCfg.getProblematicNodes().contains(problematicNode)) { } else if (!infeasibleCfg.getProblematicNodes().contains(problematicNode)) {
throw new IllegalArgumentException("Only problematic nodes must be placed in problematic spots."); throw new IllegalArgumentException("Only problematic nodes must be placed in problematic spots.");
} }
}
boolean useCurrentLayer = possibleLayers.contains(infeasibleCfg.getLayers().getDepth(problematicNode.getId())); boolean useCurrentLayer = possibleLayers.contains(infeasibleCfg.getLayers().getDepth(problematicNode.getId()));
...@@ -226,16 +228,6 @@ public class InfeasibleNodePlacer implements Initializable { ...@@ -226,16 +228,6 @@ public class InfeasibleNodePlacer implements Initializable {
} }
} }
@Override
public void init(SeededRandom rng) {
this.rng = rng;
}
@Override
public void reset() {
// Do nothing.
}
private void moveNodeToLayer(ResourceNode node, int layer) { private void moveNodeToLayer(ResourceNode node, int layer) {
Set<Integer> swappableIDs = new HashSet<>(); Set<Integer> swappableIDs = new HashSet<>();
......
...@@ -17,266 +17,21 @@ ...@@ -17,266 +17,21 @@
package graphgen.generator.components.properties.infeasibleMinII; package graphgen.generator.components.properties.infeasibleMinII;
import graphgen.generator.components.properties.infeasibleMinII.configuration.InfeasibleConfiguration;
import graphgen.generator.components.properties.infeasibleMinII.configuration.StartConfiguration;
import graphgen.generator.exceptions.InfeasibilityImpossibleException; import graphgen.generator.exceptions.InfeasibilityImpossibleException;
import graphgen.graph.LayerStructure;
import graphgen.graph.Resource; import graphgen.graph.Resource;
import graphgen.graph.ResourceNode; import graphgen.graph.ResourceNode;
import graphgen.util.JavaUtils;
import modsched.Node;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
public class InfeasibilityInspectorTest { public class InfeasibilityInspectorTest {
@Test
public void possibleLayers_ZeroDelay() {
Map<Integer, Integer> depthsByID = new HashMap<>();
depthsByID.put(2, 0);
depthsByID.put(3, 1);
depthsByID.put(4, 2);
depthsByID.put(5, 2);
depthsByID.put(6, 3);
depthsByID.put(7, 3);
depthsByID.put(8, 4);
LayerStructure layers = new LayerStructure(depthsByID);
Resource problematic = new Resource("problematic", 0, 3);
Resource unlimited = new Resource("unlimited", 0);
ResourceNode node2 = new ResourceNode(2, problematic);
ResourceNode node3 = new ResourceNode(3, unlimited);
ResourceNode node4 = new ResourceNode(4, unlimited);
ResourceNode node5 = new ResourceNode(5, unlimited);
ResourceNode node6 = new ResourceNode(6, problematic);
ResourceNode node7 = new ResourceNode(7, problematic);
ResourceNode node8 = new ResourceNode(8, problematic);
Set<ResourceNode> nodes = JavaUtils.asSet(node2, node3, node4, node5, node6, node7, node8);
Map<Integer, ResourceNode> nodeTable = nodes.stream().collect(Collectors.toMap(Node::getId, n -> n));
StartConfiguration startCfg = new StartConfiguration(layers, nodeTable, problematic, 0);
startCfg.setDestinationNode(node2);
startCfg.setDestinationNodeLayer(0);
InfeasibleConfiguration infeasibleCfg = new InfeasibleConfiguration(startCfg);
infeasibleCfg.addProblematicNode(node2);
infeasibleCfg.addProblematicNode(node6);
infeasibleCfg.addProblematicNode(node7);
infeasibleCfg.addProblematicNode(node8);
// Assume that node 2 is a problematic destination node.
infeasibleCfg.fixateNode(node2);
// Now try to place node 6 in different target layers.
InfeasibleNodePlacer placer = new InfeasibleNodePlacer(startCfg, infeasibleCfg);
assertEquals(JavaUtils.asSet(1, 2, 3, 4), placer.getPossibleLayers(node6));
// Now assume that node 6 has been fixed already - locking zero nodes 3 and 4 in place as well.
infeasibleCfg.fixateNode(node3);
infeasibleCfg.fixateNode(node4);
infeasibleCfg.fixateNode(node6);
assertEquals(JavaUtils.asSet(2, 3, 4), placer.getPossibleLayers(node7));
// Now assume that node 7 has been fixed as well (using zero nodes 3 and 4 as well).
infeasibleCfg.fixateNode(node7);
assertEquals(JavaUtils.asSet(2, 4), placer.getPossibleLayers(node8));
}
@Test
public void possibleLayers_NonZeroDelay_Possible() {
Map<Integer, Integer> depthsByID = new HashMap<>();
depthsByID.put(2, 0);
depthsByID.put(3, 1);
depthsByID.put(4, 2);
depthsByID.put(5, 2);
depthsByID.put(6, 3);
depthsByID.put(7, 3);
depthsByID.put(8, 4);
LayerStructure layers = new LayerStructure(depthsByID);
Resource problematic = new Resource("problematic", 1, 2);
Resource unlimited = new Resource("unlimited", 0);
ResourceNode node2 = new ResourceNode(2, problematic);
ResourceNode node3 = new ResourceNode(3, unlimited);
ResourceNode node4 = new ResourceNode(4, unlimited);
ResourceNode node5 = new ResourceNode(5, unlimited);
ResourceNode node6 = new ResourceNode(6, problematic);
ResourceNode node7 = new ResourceNode(7, problematic);
ResourceNode node8 = new ResourceNode(8, problematic);
Set<ResourceNode> nodes = JavaUtils.asSet(node2, node3, node4, node5, node6, node7, node8);
Map<Integer, ResourceNode> nodeTable = nodes.stream().collect(Collectors.toMap(Node::getId, n -> n));
StartConfiguration startCfg = new StartConfiguration(layers, nodeTable, problematic, 1);
startCfg.setDestinationNode(node3);
startCfg.setDestinationNodeLayer(0);
InfeasibleConfiguration infeasibleCfg = new InfeasibleConfiguration(startCfg);
infeasibleCfg.addProblematicNode(node2);
infeasibleCfg.addProblematicNode(node6);
infeasibleCfg.addProblematicNode(node7);
// Assume that node 3 is an unproblematic destination node.
infeasibleCfg.fixateNode(node3);
// Now try to place node 2 in different target layers.
InfeasibleNodePlacer placer = new InfeasibleNodePlacer(startCfg, infeasibleCfg);
assertEquals(JavaUtils.asSet(2, 3, 4), placer.getPossibleLayers(node2));
// Now assume that node 6 has been fixed again - locking zero node 4 in place as well.
infeasibleCfg.fixateNode(node4);
infeasibleCfg.fixateNode(node6);
assertEquals(JavaUtils.asSet(2, 3, 4), placer.getPossibleLayers(node2));
// Now assume that node 7 has been fixed as well in layer 2 (using zero/destination node 3).
layers.swapIDs(5, 7);
infeasibleCfg.fixateNode(node7);
assertEquals(JavaUtils.asSet(3, 4), placer.getPossibleLayers(node2));
}
@Test
public void possibleLayers_NonZeroDelay_Impossible() {
Map<Integer, Integer> depthsByID = new HashMap<>();
depthsByID.put(2, 0);
depthsByID.put(3, 1);
depthsByID.put(4, 2);
depthsByID.put(5, 2);
depthsByID.put(6, 3);
depthsByID.put(7, 3);
depthsByID.put(8, 4);
LayerStructure layers = new LayerStructure(depthsByID);
Resource problematic = new Resource("problematic", 1, 3);
Resource unlimited = new Resource("unlimited", 0);
ResourceNode node2 = new ResourceNode(2, problematic);
ResourceNode node3 = new ResourceNode(3, unlimited);
ResourceNode node4 = new ResourceNode(4, unlimited);
ResourceNode node5 = new ResourceNode(5, unlimited);
ResourceNode node6 = new ResourceNode(6, problematic);
ResourceNode node7 = new ResourceNode(7, problematic);
ResourceNode node8 = new ResourceNode(8, problematic);
Set<ResourceNode> nodes = JavaUtils.asSet(node2, node3, node4, node5, node6, node7, node8);
Map<Integer, ResourceNode> nodeTable = nodes.stream().collect(Collectors.toMap(Node::getId, n -> n));
StartConfiguration startCfg = new StartConfiguration(layers, nodeTable, problematic, 1);
startCfg.setDestinationNode(node3);
startCfg.setDestinationNodeLayer(0);
InfeasibleConfiguration infeasibleCfg = new InfeasibleConfiguration(startCfg);
infeasibleCfg.addProblematicNode(node2);
infeasibleCfg.addProblematicNode(node6);
infeasibleCfg.addProblematicNode(node7);
infeasibleCfg.addProblematicNode(node8);
// Assume that node 3 is an unproblematic destination node.
infeasibleCfg.fixateNode(node3);
// Now try to place node 2 in different target layers.
InfeasibleNodePlacer placer = new InfeasibleNodePlacer(startCfg, infeasibleCfg);
assertTrue(placer.getPossibleLayers(node2).isEmpty());
// Now assume that node 6 has been fixed again - locking zero node 4 in place as well.
infeasibleCfg.fixateNode(node4);
infeasibleCfg.fixateNode(node6);
assertTrue(placer.getPossibleLayers(node2).isEmpty());
// Now assume that node 7 has been fixed as well in layer 2 (using zero/destination node 3).
layers.swapIDs(5, 7);
infeasibleCfg.fixateNode(node7);
assertTrue(placer.getPossibleLayers(node2).isEmpty());
// Now assume that node 2 has been fixed as well in layer 3 (using zero node 4).
layers.swapIDs(2, 5);
infeasibleCfg.fixateNode(node2);
// Assert that node 8 cannot be placed in layer 4 anymore.
assertTrue(placer.getPossibleLayers(node8).isEmpty());
}
@Test
public void possibleLayers_BogusArguments() {
Map<Integer, Integer> depthsByID = new HashMap<>();
depthsByID.put(2, 0);
depthsByID.put(3, 1);
depthsByID.put(4, 2);
depthsByID.put(5, 2);
depthsByID.put(6, 3);
depthsByID.put(7, 3);
depthsByID.put(8, 4);
LayerStructure layers = new LayerStructure(depthsByID);
Resource problematic = new Resource("problematic", 0, 3);
Resource unlimited = new Resource("unlimited", 0);
ResourceNode node2 = new ResourceNode(2, problematic);
ResourceNode node3 = new ResourceNode(3, unlimited);
ResourceNode node4 = new ResourceNode(4, unlimited);
ResourceNode node5 = new ResourceNode(5, unlimited);
ResourceNode node6 = new ResourceNode(6, problematic);
ResourceNode node7 = new ResourceNode(7, problematic);
ResourceNode node8 = new ResourceNode(8, problematic);
Set<ResourceNode> nodes = JavaUtils.asSet(node2, node3, node4, node5, node6, node7, node8);
Map<Integer, ResourceNode> nodeTable = nodes.stream().collect(Collectors.toMap(Node::getId, n -> n));
StartConfiguration startCfg = new StartConfiguration(layers, nodeTable, problematic, 0);
startCfg.setDestinationNode(node2);
startCfg.setDestinationNodeLayer(0);
InfeasibleConfiguration infeasibleCfg = new InfeasibleConfiguration(startCfg);
infeasibleCfg.addProblematicNode(node2);
infeasibleCfg.addProblematicNode(node6);
infeasibleCfg.addProblematicNode(node7);
infeasibleCfg.addProblematicNode(node8);
// Assume that node 3 is a problematic destination node.
infeasibleCfg.fixateNode(node3);
InfeasibleNodePlacer placer = new InfeasibleNodePlacer(startCfg, infeasibleCfg);
try {
placer.getPossibleLayers(null);
fail("This call should have failed!");
} catch (NullPointerException expected) {
}
try {
placer.getPossibleLayers(node3);
fail("This call should have failed!");
} catch (IllegalArgumentException expected) {
}
}
@Test @Test
public void problematicResources_Limits() { public void problematicResources_Limits() {
Resource problematic1 = new Resource("problematic1", 0, 1); Resource problematic1 = new Resource("problematic1", 0, 1);
......
...@@ -27,6 +27,7 @@ import graphgen.graph.Resource; ...@@ -27,6 +27,7 @@ import graphgen.graph.Resource;
import graphgen.graph.ResourceNode; import graphgen.graph.ResourceNode;
import graphgen.util.JavaUtils; import graphgen.util.JavaUtils;
import modsched.Node; import modsched.Node;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
...@@ -43,6 +44,13 @@ import static org.junit.Assert.assertTrue; ...@@ -43,6 +44,13 @@ import static org.junit.Assert.assertTrue;
public class InfeasibleEdgePlannerTest { public class InfeasibleEdgePlannerTest {
private SeededRandom rng;
@Before
public void init() {
rng = new SeededRandom(42);
}
@Test @Test
public void getProblematicTimeslots_ZeroDelay() { public void getProblematicTimeslots_ZeroDelay() {
...@@ -96,8 +104,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -96,8 +104,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
// Calculate possible timeslots for the problematic nodes (relative to the destination node). // Calculate possible timeslots for the problematic nodes (relative to the destination node).
Set<Integer> timeslots = planner.getProblematicTimeslots(); Set<Integer> timeslots = planner.getProblematicTimeslots();
...@@ -167,8 +174,9 @@ public class InfeasibleEdgePlannerTest { ...@@ -167,8 +174,9 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg,
planner.init(new SeededRandom(42)); new SeededRandom(42)
);
// Calculate possible timeslots for the problematic nodes (relative to the destination node). // Calculate possible timeslots for the problematic nodes (relative to the destination node).
Set<Integer> timeslots = planner.getProblematicTimeslots(); Set<Integer> timeslots = planner.getProblematicTimeslots();
...@@ -230,8 +238,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -230,8 +238,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
// The problematic timeslot cannot be anything else but 2. // The problematic timeslot cannot be anything else but 2.
assertEquals(JavaUtils.asSet(2), planner.getProblematicTimeslots()); assertEquals(JavaUtils.asSet(2), planner.getProblematicTimeslots());
...@@ -294,8 +301,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -294,8 +301,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
// Calculate possible timeslots for the problematic nodes (relative to the destination node). // Calculate possible timeslots for the problematic nodes (relative to the destination node).
Set<Integer> timeslots = planner.getProblematicTimeslots(); Set<Integer> timeslots = planner.getProblematicTimeslots();
...@@ -361,8 +367,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -361,8 +367,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
// Calculate possible timeslots for the problematic nodes (relative to the destination node). // Calculate possible timeslots for the problematic nodes (relative to the destination node).
Set<Integer> timeslots = planner.getProblematicTimeslots(); Set<Integer> timeslots = planner.getProblematicTimeslots();
...@@ -428,8 +433,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -428,8 +433,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0); PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0);
PlannedEdge edge3_5 = new PlannedEdge(node3, node5, 0, 0); PlannedEdge edge3_5 = new PlannedEdge(node3, node5, 0, 0);
...@@ -500,8 +504,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -500,8 +504,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0); PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0);
PlannedEdge edge3_5 = new PlannedEdge(node3, node5, 0, 0); PlannedEdge edge3_5 = new PlannedEdge(node3, node5, 0, 0);
...@@ -571,8 +574,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -571,8 +574,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0); PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0);
PlannedEdge edge4_6 = new PlannedEdge(node4, node6, 0, 0); PlannedEdge edge4_6 = new PlannedEdge(node4, node6, 0, 0);
...@@ -638,8 +640,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -638,8 +640,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);
backedgeSources.forEach(suffixCfg::addBackedgeSource); backedgeSources.forEach(suffixCfg::addBackedgeSource);
InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg); InfeasibleEdgePlanner planner = new InfeasibleEdgePlanner(startCfg, infeasibleCfg, suffixCfg, rng);
planner.init(new SeededRandom(42));
PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0); PlannedEdge edge3_4 = new PlannedEdge(node3, node4, 0, 0);
PlannedEdge edge4_6 = new PlannedEdge(node4, node6, 0, 0); PlannedEdge edge4_6 = new PlannedEdge(node4, node6, 0, 0);
...@@ -709,8 +710,7 @@ public class InfeasibleEdgePlannerTest { ...@@ -709,8 +710,7 @@ public class InfeasibleEdgePlannerTest {
suffixNodes.forEach(suffixCfg::appendSuffixNode); suffixNodes.forEach(suffixCfg::appendSuffixNode);