Package jsprit.core.problem.vehicle

Examples of jsprit.core.problem.vehicle.Vehicle


  @Test
  public void whenReadingFile_v4HasTheCorrectLocationCoordinate(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Vehicle v = getVehicle("v4",vrp.getVehicles());
    assertEquals(10.0,v.getStartLocationCoordinate().getX(),0.01);
    assertEquals(100.0,v.getStartLocationCoordinate().getY(),0.01);
  }
View Full Code Here


  @Test
  public void whenReadingFile_v4HasTheCorrectLocationId(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Vehicle v = getVehicle("v4",vrp.getVehicles());
    assertEquals("startLoc",v.getStartLocationId());
  }
View Full Code Here

  @Test
  public void whenReadingFile_v5AndItsTypeHasTheCorrectCapacityDimensionValues(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Vehicle v = getVehicle("v5",vrp.getVehicles());
    assertEquals(100, v.getType().getCapacityDimensions().get(0));
    assertEquals(1000, v.getType().getCapacityDimensions().get(1));
    assertEquals(10000, v.getType().getCapacityDimensions().get(2));
    assertEquals(0, v.getType().getCapacityDimensions().get(3));
    assertEquals(0, v.getType().getCapacityDimensions().get(5));
    assertEquals(100000, v.getType().getCapacityDimensions().get(10));   
  }
View Full Code Here

      }
      else if(counter == 1){
        Coordinate depotCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
        VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance("christophidesType").addCapacityDimension(0, vehicleCapacity).
            setCostPerDistance(1.0).build();
        Vehicle vehicle = VehicleImpl.Builder.newInstance("christophidesVehicle").setLatestArrival(endTime).setStartLocationCoordinate(depotCoord).
            setType(vehicleType).build();
        vrpBuilder.addVehicle(vehicle);
      }
      else{
        Coordinate customerCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
View Full Code Here

          }
          else throw new IllegalStateException("option " + vrphType + " cannot be applied with this instance");
        }
        for(int i=0;i<nuOfVehicles;i++){
          VehicleTypeImpl type = typeBuilder.build();
          Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle_"+tokens[1]+"_"+i)
              .setStartLocationCoordinate(depotCoord).setType(type).build();
          vrpBuilder.addVehicle(vehicle);
        }
      }
    }
View Full Code Here

        new VrpXMLReader(vrpBuilder).read("src/test/resources/solomon_c101.xml");
        VehicleRoutingProblem vrp = vrpBuilder.build();

        //y >= 50 skill1 otherwise skill2
        //two vehicles: v1 - skill1 #5; v2 - skill2 #6
        Vehicle solomonVehicle = vrp.getVehicles().iterator().next();
        VehicleType newType = solomonVehicle.getType();
        VehicleRoutingProblem.Builder skillProblemBuilder = VehicleRoutingProblem.Builder.newInstance();
        for(int i=0;i<6;i++) {
            VehicleImpl skill1Vehicle = VehicleImpl.Builder.newInstance("skill1_vehicle_"+i).addSkill("skill1")
                    .setStartLocationCoordinate(solomonVehicle.getStartLocationCoordinate()).setStartLocationId(solomonVehicle.getStartLocationId())
                    .setEarliestStart(solomonVehicle.getEarliestDeparture())
                    .setType(newType).build();
            VehicleImpl skill2Vehicle = VehicleImpl.Builder.newInstance("skill2_vehicle_"+i).addSkill("skill2")
                    .setStartLocationCoordinate(solomonVehicle.getStartLocationCoordinate()).setStartLocationId(solomonVehicle.getStartLocationId())
                    .setEarliestStart(solomonVehicle.getEarliestDeparture())
                    .setType(newType).build();
            skillProblemBuilder.addVehicle(skill1Vehicle).addVehicle(skill2Vehicle);
        }
        for(Job job : vrp.getJobs().values()){
            Service service = (Service) job;
View Full Code Here

  public void read(String filename){
    readShipments(filename);
    buildShipments();
    VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0, vehicleCapacity)
        .setCostPerDistance(1.0).setFixedCost(fixCosts).build();
    Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle")
        .setEarliestStart(depotOpeningTime).setLatestArrival(depotClosingTime)
        .setStartLocationCoordinate(customers.get(depotId).coord).setType(type).build();
    vrpBuilder.addVehicle(vehicle);
  }
View Full Code Here

        new VrpXMLWriter(vrp, null).write(infileName);

        VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
        VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
        Vehicle veh1 = getVehicle("v1",readVrp);

        assertEquals(3,veh1.getSkills().values().size());
    }
View Full Code Here

        new VrpXMLWriter(vrp, null).write(infileName);

        VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
        VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
        Vehicle veh1 = getVehicle("v1",readVrp);

        assertTrue(veh1.getSkills().containsSkill("skill5"));
    }
View Full Code Here

        new VrpXMLWriter(vrp, null).write(infileName);

        VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(vrpToReadBuilder, null).read(infileName);
        VehicleRoutingProblem readVrp = vrpToReadBuilder.build();
        Vehicle veh1 = getVehicle("v1",readVrp);

        assertTrue(veh1.getSkills().containsSkill("skill1"));
    }
View Full Code Here

TOP

Related Classes of jsprit.core.problem.vehicle.Vehicle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.