mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
modify goldenReader to accomodate the various FSM and HVRP problems
This commit is contained in:
parent
c723415839
commit
66df42ac2e
3 changed files with 158 additions and 38 deletions
|
|
@ -1,5 +1,114 @@
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
|
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
|
import jsprit.analysis.toolbox.SolutionPrinter.Print;
|
||||||
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
|
import jsprit.core.problem.job.Service;
|
||||||
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.util.Coordinate;
|
||||||
|
import jsprit.core.util.Solutions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* customers (id,x,y,demand)
|
||||||
|
* 1 22 22 18
|
||||||
|
* 2 36 26 26
|
||||||
|
* 3 21 45 11
|
||||||
|
* 4 45 35 30
|
||||||
|
* 5 55 20 21
|
||||||
|
* 6 33 34 19
|
||||||
|
* 7 50 50 15
|
||||||
|
* 8 55 45 16
|
||||||
|
* 9 26 59 29
|
||||||
|
* 10 40 66 26
|
||||||
|
* 11 55 65 37
|
||||||
|
* 12 35 51 16
|
||||||
|
* 13 62 35 12
|
||||||
|
* 14 62 57 31
|
||||||
|
* 15 62 24 8
|
||||||
|
* 16 21 36 19
|
||||||
|
* 17 33 44 20
|
||||||
|
* 18 9 56 13
|
||||||
|
* 19 62 48 15
|
||||||
|
* 20 66 14 22
|
||||||
|
*
|
||||||
|
* vehicles (id,cap,fixed costs, perDistance, #vehicles) at location (40,40)
|
||||||
|
* 1 120 1000 1.0 2
|
||||||
|
* 2 160 1500 1.1 1
|
||||||
|
* 3 300 3500 1.4 1
|
||||||
|
*
|
||||||
|
* @author schroeder
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class VFMExample {
|
public class VFMExample {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
||||||
|
//add customers
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("1", 18).setCoord(Coordinate.newInstance(22, 22)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("2", 26).setCoord(Coordinate.newInstance(36, 26)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("3", 11).setCoord(Coordinate.newInstance(21, 45)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("4", 30).setCoord(Coordinate.newInstance(45, 35)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("5", 21).setCoord(Coordinate.newInstance(55, 20)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("6", 19).setCoord(Coordinate.newInstance(33, 34)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("7", 15).setCoord(Coordinate.newInstance(50, 50)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("8", 16).setCoord(Coordinate.newInstance(55, 45)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("9", 29).setCoord(Coordinate.newInstance(26, 59)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("10", 26).setCoord(Coordinate.newInstance(40, 66)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("11", 37).setCoord(Coordinate.newInstance(55, 56)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("12", 16).setCoord(Coordinate.newInstance(35, 51)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("13", 12).setCoord(Coordinate.newInstance(62, 35)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("14", 31).setCoord(Coordinate.newInstance(62, 57)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("15", 8).setCoord(Coordinate.newInstance(62, 24)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("16", 19).setCoord(Coordinate.newInstance(21, 36)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("17", 20).setCoord(Coordinate.newInstance(33, 44)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("18", 13).setCoord(Coordinate.newInstance(9, 56)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("19", 15).setCoord(Coordinate.newInstance(62, 48)).build());
|
||||||
|
vrpBuilder.addJob(Service.Builder.newInstance("20", 22).setCoord(Coordinate.newInstance(66, 14)).build());
|
||||||
|
|
||||||
|
|
||||||
|
//add vehicle - finite fleet
|
||||||
|
//fixed costs only (and equal variable costs)
|
||||||
|
//vehicle type1
|
||||||
|
VehicleType type1 = VehicleTypeImpl.Builder.newInstance("type_1", 120).setCostPerDistance(1.0).setFixedCost(1000).build();
|
||||||
|
VehicleImpl vehicle1 = VehicleImpl.Builder.newInstance("1_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type1).build();
|
||||||
|
vrpBuilder.addVehicle(vehicle1);
|
||||||
|
//vehicle type2
|
||||||
|
VehicleType type2 = VehicleTypeImpl.Builder.newInstance("type_2", 160).setCostPerDistance(1.0).setFixedCost(1500).build();
|
||||||
|
VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("2_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type2).build();
|
||||||
|
vrpBuilder.addVehicle(vehicle2);
|
||||||
|
//vehicle type3
|
||||||
|
VehicleType type3 = VehicleTypeImpl.Builder.newInstance("type_3", 300).setCostPerDistance(1.0).setFixedCost(3500).build();
|
||||||
|
VehicleImpl vehicle3 = VehicleImpl.Builder.newInstance("3_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type3).build();
|
||||||
|
vrpBuilder.addVehicle(vehicle3);
|
||||||
|
|
||||||
|
//set fleetsize finite - which actually the default value, thus it does not need to be set
|
||||||
|
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||||
|
|
||||||
|
//build problem
|
||||||
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
|
|
||||||
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||||
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
|
VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
|
||||||
|
|
||||||
|
SolutionPrinter.print(vrp, best, Print.VERBOSE);
|
||||||
|
|
||||||
|
new GraphStreamViewer(vrp, best).setRenderDelay(100).display();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,12 @@ import jsprit.core.util.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads modified files from Taillard's website
|
* Reads modified files from Taillard's website
|
||||||
* http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html
|
* http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html. You can find the modified version here:
|
||||||
|
* jsprit-instances/instances/vrph.
|
||||||
*
|
*
|
||||||
* <p>diff. options of VrphType yields to different problem types for
|
* <p>See {@link VrphType} what kind of problems can be generated
|
||||||
* - vrphe with infinite fleet, i.e. different types with different variable costs and infinite number of vehicles of each type
|
|
||||||
* - vrphe with finite fleet, i.e. different types with different variable costs and finite number of vehicles of each type
|
|
||||||
* - vfm, different types with different fixed costs
|
|
||||||
* - vfmvrc different types with different fixed costs and variable costs
|
|
||||||
*
|
*
|
||||||
* <p>cxxx3-cxxx6 do not have variable costs and nuVehicle, thus they can only be used for vfm.
|
* <p>Note that c20_3-c20_6 do not have variable costs and a limited nuVehicle, thus they can only be used for FSMF.
|
||||||
*
|
*
|
||||||
* @author schroeder
|
* @author schroeder
|
||||||
*
|
*
|
||||||
|
|
@ -35,16 +32,21 @@ public class VrphGoldenReader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* VRPHE_INFINITE - different types with different variable costs and infinite number of vehicles of each type
|
* <b>FSMD</b> - Fleet Size and Mix with Dependent costs
|
||||||
* <p>VRPHE_FINITE - different types with different variable costs and finite number of vehicles of each type
|
* <p><b>FSMF</b> - Fleet Size and Mix with Fixed costs
|
||||||
* <p>VFM - different types with different fixed costs
|
* <p><b>FSMFD</b> - Fleet Size and Mix with Fixed and Dependent costs
|
||||||
* <p>VFMVRC - different types with different fixed costs and variable costs
|
* <p><b>HVRPD</b> - Heterogeneous Vehicle Routing Problem with Dependent costs and finite (limited) fleet
|
||||||
*
|
* <p><b>HVRPFD</b> - Heterogeneous Vehicle Routing Problem with Fixed and Dependent costs and finite (limited) fleet
|
||||||
|
*
|
||||||
* @author schroeder
|
* @author schroeder
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum VrphType {
|
public enum VrphType {
|
||||||
VRPH_INFINITE, VRPH_FINITE, VFM, VFMVRC
|
FSMD,
|
||||||
|
HVRPD,
|
||||||
|
FSMF,
|
||||||
|
FSMFD,
|
||||||
|
HVRPFD
|
||||||
}
|
}
|
||||||
|
|
||||||
private final VehicleRoutingProblem.Builder vrpBuilder;
|
private final VehicleRoutingProblem.Builder vrpBuilder;
|
||||||
|
|
@ -87,23 +89,23 @@ public class VrphGoldenReader {
|
||||||
else if(trimedLine.startsWith("v")){
|
else if(trimedLine.startsWith("v")){
|
||||||
VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("type_"+tokens[1], Integer.parseInt(tokens[2]));
|
VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("type_"+tokens[1], Integer.parseInt(tokens[2]));
|
||||||
int nuOfVehicles = 1;
|
int nuOfVehicles = 1;
|
||||||
if(vrphType.equals(VrphType.VFM)){
|
if(vrphType.equals(VrphType.FSMF)){
|
||||||
typeBuilder.setFixedCost(Double.parseDouble(tokens[3]));
|
typeBuilder.setFixedCost(Double.parseDouble(tokens[3]));
|
||||||
}
|
}
|
||||||
else if(vrphType.equals(VrphType.VFMVRC)){
|
else if(vrphType.equals(VrphType.FSMFD)){
|
||||||
typeBuilder.setFixedCost(Double.parseDouble(tokens[3]));
|
typeBuilder.setFixedCost(Double.parseDouble(tokens[3]));
|
||||||
if(tokens.length > 4){
|
if(tokens.length > 4){
|
||||||
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
||||||
}
|
}
|
||||||
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
||||||
}
|
}
|
||||||
else if(vrphType.equals(VrphType.VRPH_INFINITE)){
|
else if(vrphType.equals(VrphType.FSMD)){
|
||||||
if(tokens.length > 4){
|
if(tokens.length > 4){
|
||||||
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
||||||
}
|
}
|
||||||
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
||||||
}
|
}
|
||||||
else { //VrphType.VRPH_FINITE
|
else if(vrphType.equals(VrphType.HVRPD)){
|
||||||
if(tokens.length > 4){
|
if(tokens.length > 4){
|
||||||
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
||||||
nuOfVehicles = Integer.parseInt(tokens[5]);
|
nuOfVehicles = Integer.parseInt(tokens[5]);
|
||||||
|
|
@ -111,6 +113,15 @@ public class VrphGoldenReader {
|
||||||
}
|
}
|
||||||
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
||||||
}
|
}
|
||||||
|
else if (vrphType.equals(VrphType.HVRPFD)){
|
||||||
|
if(tokens.length > 4){
|
||||||
|
typeBuilder.setFixedCost(Double.parseDouble(tokens[3]));
|
||||||
|
typeBuilder.setCostPerDistance(Double.parseDouble(tokens[4]));
|
||||||
|
nuOfVehicles = Integer.parseInt(tokens[5]);
|
||||||
|
vrpBuilder.setFleetSize(FleetSize.FINITE);
|
||||||
|
}
|
||||||
|
else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
|
||||||
|
}
|
||||||
for(int i=0;i<nuOfVehicles;i++){
|
for(int i=0;i<nuOfVehicles;i++){
|
||||||
VehicleTypeImpl type = typeBuilder.build();
|
VehicleTypeImpl type = typeBuilder.build();
|
||||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle_"+tokens[1]+"_"+i)
|
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle_"+tokens[1]+"_"+i)
|
||||||
|
|
@ -156,7 +167,7 @@ public class VrphGoldenReader {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
VrphGoldenReader goldenReader = new VrphGoldenReader(vrpBuilder, VrphType.VRPH_INFINITE);
|
VrphGoldenReader goldenReader = new VrphGoldenReader(vrpBuilder, VrphType.FSMD);
|
||||||
goldenReader.read("instances/vrph/orig/cn_13mix.txt");
|
goldenReader.read("instances/vrph/orig/cn_13mix.txt");
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
new VrpXMLWriter(vrp).write("instances/vrph/cn_13mix_VRPH_INFINITE.xml");
|
new VrpXMLWriter(vrp).write("instances/vrph/cn_13mix_VRPH_INFINITE.xml");
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfVehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfVehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
assertEquals(17,vrp.getVehicles().size());
|
assertEquals(17,vrp.getVehicles().size());
|
||||||
|
|
@ -26,7 +26,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType1Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType1Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -41,7 +41,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType1VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType1VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -56,7 +56,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType2Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType2Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -71,7 +71,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType2VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType2VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -86,7 +86,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType3Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType3Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -101,7 +101,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType3VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType3VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -116,7 +116,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType4Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType4Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -131,7 +131,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType4VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType4VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -146,7 +146,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType5Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType5Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -161,7 +161,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType5VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType5VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -176,7 +176,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_itShouldReadCorrectNuOfType6Vehicles(){
|
public void whenReadingInstance_itShouldReadCorrectNuOfType6Vehicles(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int nuOfType1Vehicles = 0;
|
int nuOfType1Vehicles = 0;
|
||||||
|
|
@ -191,7 +191,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_theSumOfType6VehicleShouldHvTheCorrectCapacity(){
|
public void whenReadingInstance_theSumOfType6VehicleShouldHvTheCorrectCapacity(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
int sumOfType1Cap = 0;
|
int sumOfType1Cap = 0;
|
||||||
|
|
@ -206,7 +206,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_vehicleShouldHvTheCorrectCoord(){
|
public void whenReadingInstance_vehicleShouldHvTheCorrectCoord(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
for(Vehicle v : vrp.getVehicles()){
|
for(Vehicle v : vrp.getVehicles()){
|
||||||
|
|
@ -223,7 +223,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service1MustHaveCorrectDemand(){
|
public void whenReadingInstance_service1MustHaveCorrectDemand(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Job job = getJob("1",vrp);
|
Job job = getJob("1",vrp);
|
||||||
|
|
@ -233,7 +233,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service1MustHaveCorrectCoordinate(){
|
public void whenReadingInstance_service1MustHaveCorrectCoordinate(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Coordinate coord = getCoord("1",vrp);
|
Coordinate coord = getCoord("1",vrp);
|
||||||
|
|
@ -244,7 +244,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service15MustHaveCorrectCoordinate(){
|
public void whenReadingInstance_service15MustHaveCorrectCoordinate(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Coordinate coord = getCoord("15",vrp);
|
Coordinate coord = getCoord("15",vrp);
|
||||||
|
|
@ -257,7 +257,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service50MustHaveCorrectCoordinate(){
|
public void whenReadingInstance_service50MustHaveCorrectCoordinate(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Coordinate coord = getCoord("50",vrp);
|
Coordinate coord = getCoord("50",vrp);
|
||||||
|
|
@ -273,7 +273,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service4MustHaveCorrectDemand(){
|
public void whenReadingInstance_service4MustHaveCorrectDemand(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Job job = getJob("4",vrp);
|
Job job = getJob("4",vrp);
|
||||||
|
|
@ -283,7 +283,7 @@ public class GoldenReaderTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenReadingInstance_service50MustHaveCorrectDemand(){
|
public void whenReadingInstance_service50MustHaveCorrectDemand(){
|
||||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
new VrphGoldenReader(vrpBuilder, VrphType.VRPH_FINITE)
|
new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
|
||||||
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
.read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
Job job = getJob("50",vrp);
|
Job job = getJob("50",vrp);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue