mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
adjusted reader-tests
This commit is contained in:
parent
71f19d9fbe
commit
42eaa0ad76
4 changed files with 27 additions and 27 deletions
|
|
@ -50,7 +50,7 @@ public class ChristophidesReaderTest {
|
|||
new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(160,v.getCapacity());
|
||||
assertEquals(160,v.getType().getCapacityDimensions().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +60,8 @@ public class ChristophidesReaderTest {
|
|||
new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(30.0,v.getCoord().getX(),0.01);
|
||||
assertEquals(40.0,v.getCoord().getY(),0.01);
|
||||
assertEquals(30.0,v.getStartLocationCoordinate().getX(),0.01);
|
||||
assertEquals(40.0,v.getStartLocationCoordinate().getY(),0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public class ChristophidesReaderTest {
|
|||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(7,vrp.getJobs().get("1").getCapacityDemand());
|
||||
assertEquals(7,vrp.getJobs().get("1").getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class CordeauReaderTest {
|
|||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(80, v.getCapacity());
|
||||
assertEquals(80, v.getType().getCapacityDimensions().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ public class CordeauReaderTest {
|
|||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("3");
|
||||
assertEquals(16.0, service.getCapacityDemand(), 0.1);
|
||||
assertEquals(16.0, service.getSize().get(0), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -109,7 +109,7 @@ public class CordeauReaderTest {
|
|||
new CordeauReader(vrpBuilder).read(this.getClass().getClassLoader().getResource("p01").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Service service = (Service) vrp.getJobs().get("47");
|
||||
assertEquals(25.0, service.getCapacityDemand(), 0.1);
|
||||
assertEquals(25.0, service.getSize().get(0), 0.1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -123,11 +123,11 @@ public class CordeauReaderTest {
|
|||
boolean loc3ok = false;
|
||||
boolean loc4ok = false;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getCapacity() != 80) capacityOk = false;
|
||||
if(v.getCoord().getX() == 20.0 && v.getCoord().getY() == 20.0) loc1ok = true;
|
||||
if(v.getCoord().getX() == 30.0 && v.getCoord().getY() == 40.0) loc2ok = true;
|
||||
if(v.getCoord().getX() == 50.0 && v.getCoord().getY() == 30.0) loc3ok = true;
|
||||
if(v.getCoord().getX() == 60.0 && v.getCoord().getY() == 50.0) loc4ok = true;
|
||||
if(v.getType().getCapacityDimensions().get(0) != 80) capacityOk = false;
|
||||
if(v.getStartLocationCoordinate().getX() == 20.0 && v.getStartLocationCoordinate().getY() == 20.0) loc1ok = true;
|
||||
if(v.getStartLocationCoordinate().getX() == 30.0 && v.getStartLocationCoordinate().getY() == 40.0) loc2ok = true;
|
||||
if(v.getStartLocationCoordinate().getX() == 50.0 && v.getStartLocationCoordinate().getY() == 30.0) loc3ok = true;
|
||||
if(v.getStartLocationCoordinate().getX() == 60.0 && v.getStartLocationCoordinate().getY() == 50.0) loc4ok = true;
|
||||
}
|
||||
assertTrue(capacityOk);
|
||||
assertTrue(loc1ok);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_1") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(80,sumOfType1Cap);
|
||||
|
|
@ -84,7 +84,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_2") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(60,sumOfType1Cap);
|
||||
|
|
@ -114,7 +114,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_3") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(160,sumOfType1Cap);
|
||||
|
|
@ -144,7 +144,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_4") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(280,sumOfType1Cap);
|
||||
|
|
@ -174,7 +174,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_5") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(240,sumOfType1Cap);
|
||||
|
|
@ -204,7 +204,7 @@ public class GoldenReaderTest {
|
|||
int sumOfType1Cap = 0;
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getType().getTypeId().equals("type_6") && !(v.getType() instanceof PenaltyVehicleType) ){
|
||||
sumOfType1Cap+=v.getCapacity();
|
||||
sumOfType1Cap+=v.getType().getCapacityDimensions().get(0);
|
||||
}
|
||||
}
|
||||
assertEquals(200,sumOfType1Cap);
|
||||
|
|
@ -217,10 +217,10 @@ public class GoldenReaderTest {
|
|||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
if(v.getCoord().getX() != 40.0){
|
||||
if(v.getStartLocationCoordinate().getX() != 40.0){
|
||||
assertFalse(true);
|
||||
}
|
||||
if(v.getCoord().getY() != 40.0){
|
||||
if(v.getStartLocationCoordinate().getY() != 40.0){
|
||||
assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ public class GoldenReaderTest {
|
|||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Job job = getJob("1",vrp);
|
||||
assertEquals(18,job.getCapacityDemand());
|
||||
assertEquals(18,job.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -284,7 +284,7 @@ public class GoldenReaderTest {
|
|||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Job job = getJob("4",vrp);
|
||||
assertEquals(30,job.getCapacityDemand());
|
||||
assertEquals(30,job.getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -294,7 +294,7 @@ public class GoldenReaderTest {
|
|||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
Job job = getJob("50",vrp);
|
||||
assertEquals(22,job.getCapacityDemand());
|
||||
assertEquals(22,job.getSize().get(0));
|
||||
}
|
||||
|
||||
private Job getJob(String string, VehicleRoutingProblem vrp) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class SolomonReaderTest {
|
|||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(200,v.getCapacity());
|
||||
assertEquals(200,v.getType().getCapacityDimensions().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +60,8 @@ public class SolomonReaderTest {
|
|||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
for(Vehicle v : vrp.getVehicles()){
|
||||
assertEquals(40.0,v.getCoord().getX(),0.01);
|
||||
assertEquals(50.0,v.getCoord().getY(),0.01);
|
||||
assertEquals(40.0,v.getStartLocationCoordinate().getX(),0.01);
|
||||
assertEquals(50.0,v.getStartLocationCoordinate().getY(),0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ public class SolomonReaderTest {
|
|||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||
new SolomonReader(builder).read(this.getClass().getClassLoader().getResource("C101_solomon.txt").getPath());
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
assertEquals(10,vrp.getJobs().get("1").getCapacityDemand());
|
||||
assertEquals(10,vrp.getJobs().get("1").getSize().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue