mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add new and unique random instance to ensure reproducibility of several run within the same jvm
This commit is contained in:
parent
4efbd1cd1e
commit
5fb9b3c73d
2 changed files with 56 additions and 41 deletions
|
|
@ -31,7 +31,8 @@ public class JspritTest {
|
|||
|
||||
@Before
|
||||
public void doBefore(){
|
||||
RandomNumberGeneration.reset();
|
||||
|
||||
// RandomNumberGeneration.reset();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -300,7 +301,6 @@ public class JspritTest {
|
|||
});
|
||||
vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(1000);
|
||||
final List<String> secondRecord = new ArrayList<String>();
|
||||
|
|
@ -357,7 +357,6 @@ public class JspritTest {
|
|||
});
|
||||
vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(1000);
|
||||
final List<String> secondRecord = new ArrayList<String>();
|
||||
|
|
@ -398,7 +397,6 @@ public class JspritTest {
|
|||
VehicleImpl v = VehicleImpl.Builder.newInstance("v").setStartLocation(Location.newInstance(0,0)).build();
|
||||
VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(s4).addJob(s3).addVehicle(v).addJob(s2).addJob(s).build();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(1000);
|
||||
final List<String> firstRecord = new ArrayList<String>();
|
||||
|
|
@ -410,7 +408,6 @@ public class JspritTest {
|
|||
});
|
||||
vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(1000);
|
||||
final List<String> secondRecord = new ArrayList<String>();
|
||||
|
|
@ -437,7 +434,6 @@ public class JspritTest {
|
|||
new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml");
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(200);
|
||||
final List<String> firstRecord = new ArrayList<String>();
|
||||
|
|
@ -449,7 +445,6 @@ public class JspritTest {
|
|||
});
|
||||
vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(200);
|
||||
final List<String> secondRecord = new ArrayList<String>();
|
||||
|
|
@ -477,7 +472,6 @@ public class JspritTest {
|
|||
new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml");
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(200);
|
||||
final List<Integer> firstRecord = new ArrayList<Integer>();
|
||||
|
|
@ -489,7 +483,6 @@ public class JspritTest {
|
|||
});
|
||||
Collection<VehicleRoutingProblemSolution> firstSolutions = vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(200);
|
||||
final List<Integer> secondRecord = new ArrayList<Integer>();
|
||||
|
|
@ -519,7 +512,6 @@ public class JspritTest {
|
|||
new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml");
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(1000);
|
||||
VariationCoefficientTermination termination = new VariationCoefficientTermination(50, 0.005);
|
||||
|
|
@ -534,7 +526,6 @@ public class JspritTest {
|
|||
});
|
||||
Collection<VehicleRoutingProblemSolution> firstSolutions = vra.searchSolutions();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
VariationCoefficientTermination secondTermination = new VariationCoefficientTermination(50, 0.005);
|
||||
second.setPrematureAlgorithmTermination(secondTermination);
|
||||
|
|
@ -566,7 +557,6 @@ public class JspritTest {
|
|||
new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml");
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm vra = Jsprit.createAlgorithm(vrp);
|
||||
vra.setMaxIterations(200);
|
||||
final List<Integer> firstRecord = new ArrayList<Integer>();
|
||||
|
|
@ -578,7 +568,6 @@ public class JspritTest {
|
|||
});
|
||||
Collection<VehicleRoutingProblemSolution> firstSolutions = vra.searchSolutions();
|
||||
|
||||
// RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(200);
|
||||
final List<Integer> secondRecord = new ArrayList<Integer>();
|
||||
|
|
@ -626,7 +615,6 @@ public class JspritTest {
|
|||
});
|
||||
vra.searchSolutions();
|
||||
|
||||
// RandomNumberGeneration.reset();
|
||||
VehicleRoutingAlgorithm second = Jsprit.createAlgorithm(vrp);
|
||||
second.setMaxIterations(200);
|
||||
final List<String> secondRecord = new ArrayList<String>();
|
||||
|
|
|
|||
|
|
@ -2,24 +2,9 @@
|
|||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>loc</id>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>loc</id>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<typeId>vehType</typeId>
|
||||
|
|
@ -48,16 +33,58 @@
|
|||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">200</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<location>
|
||||
<id>loc</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>2.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<location>
|
||||
<id>loc2</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>4.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
<solutions>
|
||||
<solution>
|
||||
<cost>10.0</cost>
|
||||
<routes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>0.0</start>
|
||||
<act type="service">
|
||||
<serviceId>1</serviceId>
|
||||
<arrTime>0.0</arrTime>
|
||||
<endTime>0.0</endTime>
|
||||
</act>
|
||||
<end>0.0</end>
|
||||
</route>
|
||||
</routes>
|
||||
<unassignedJobs>
|
||||
<job id="2"/>
|
||||
</unassignedJobs>
|
||||
</solution>
|
||||
</solutions>
|
||||
</problem>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue