Package jsprit.core.problem.vehicle

Examples of jsprit.core.problem.vehicle.VehicleImpl$NoVehicle


        assertTrue(costs == null);
    }

    @Test
    public void whenVehicleDependentInternalRouteStateIsSet_itMustBeSetCorrectly(){
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        //noinspection UnusedDeclaration
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();

        VehicleRoute route = getRoute(vehicle);
        StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
View Full Code Here


        assertEquals(10.,stateManager.getRouteState(route, vehicle, id, Double.class),0.01);
    }

    @Test
    public void whenVehicleDependentInternalRouteStateIsNotSet_itMustBeSetCorrectly(){
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        //noinspection UnusedDeclaration
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();

        VehicleRoute route = getRoute(vehicle);
        StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
View Full Code Here

        assertEquals(21, foofooState.getIndex());
    }

    @Test
    public void whenCreatingAVehicleDependentRouteState_itShouldBeMemorized(){
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        //noinspection UnusedDeclaration
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();
        VehicleRoute route = getRoute(vehicle);
        StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
        StateId id = stateManager.createStateId("myState");
View Full Code Here

        assertEquals(500, getCap.get(0));
    }

    @Test
    public void whenCreatingAVehicleDependentActivityState_itShouldBeMemorized(){
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        //noinspection UnusedDeclaration
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();
        StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
        StateId id = stateManager.createStateId("myState");
        Capacity capacity = Capacity.Builder.newInstance().addDimension(0, 500).build();
View Full Code Here

        assertEquals(500, getCap.get(0));
    }

    @Test
    public void whenMemorizingVehicleInfo_itShouldBeMemorized(){
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        //noinspection UnusedDeclaration
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();
        VehicleRoute route = getRoute(vehicle);
        StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
        StateId id = stateManager.createStateId("vehicleParam");
        double distanceParam = vehicle.getType().getVehicleCostParams().perDistanceUnit;
        stateManager.putRouteState(route,vehicle, id,distanceParam);
        assertEquals(1.,stateManager.getRouteState(route,vehicle,id, Double.class),0.01);
    }
View Full Code Here

    }

    @Test
    public void whenMemorizingTwoVehicleInfoForRoute_itShouldBeMemorized(){
        VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(4.).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();
        VehicleRoute route = getRoute(vehicle);

        //getting the indices created in vrpBuilder
        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        VehicleRoutingProblem vrp = vrpBuilder.addVehicle(vehicle).addVehicle(vehicle2).build();

        StateManager stateManager = new StateManager(vrp);
        StateId id = stateManager.createStateId("vehicleParam");
        double distanceParam = vehicle.getType().getVehicleCostParams().perDistanceUnit;
        stateManager.putRouteState(route,vehicle, id,distanceParam);
        stateManager.putRouteState(route,vehicle2,id,vehicle2.getType().getVehicleCostParams().perDistanceUnit);
        assertEquals(1., stateManager.getRouteState(route, vehicle, id, Double.class), 0.01);
        assertEquals(4.,stateManager.getRouteState(route,vehicle2,id, Double.class),0.01);
    }
View Full Code Here

    }

    @Test
    public void whenMemorizingTwoVehicleInfoForAct_itShouldBeMemorized(){
        VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(4.).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();

        //getting the indices created in vrpBuilder
        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        VehicleRoutingProblem vrp = vrpBuilder.addVehicle(vehicle).addVehicle(vehicle2).build();

        TourActivity act = mock(TourActivity.class);
        when(act.getIndex()).thenReturn(1);
        StateManager stateManager = new StateManager(vrp);
        StateId id = stateManager.createStateId("vehicleParam");
        double distanceParam = vehicle.getType().getVehicleCostParams().perDistanceUnit;
        stateManager.putActivityState(act, vehicle, id, distanceParam);
        stateManager.putActivityState(act, vehicle2, id, vehicle2.getType().getVehicleCostParams().perDistanceUnit);

        assertEquals(1., stateManager.getActivityState(act, vehicle, id, Double.class), 0.01);
        assertEquals(4.,stateManager.getActivityState(act,vehicle2, id, Double.class),0.01);
    }
View Full Code Here

    }

    @Test
    public void whenClearing_arrElementsShouldBeNull(){
        VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(4.).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
        VehicleImpl vehicle2 = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").setType(type).build();

        //getting the indices created in vrpBuilder
        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        VehicleRoutingProblem vrp = vrpBuilder.addVehicle(vehicle).addVehicle(vehicle2).build();

        TourActivity act = mock(TourActivity.class);
        when(act.getIndex()).thenReturn(1);
        StateManager stateManager = new StateManager(vrp);
        StateId id = stateManager.createStateId("vehicleParam");
        double distanceParam = vehicle.getType().getVehicleCostParams().perDistanceUnit;
        stateManager.putActivityState(act, vehicle, id, distanceParam);
        stateManager.putActivityState(act, vehicle2, id, vehicle2.getType().getVehicleCostParams().perDistanceUnit);

        stateManager.clear();

        assertNull(stateManager.getActivityState(act, vehicle, id, Double.class));
        assertNull(stateManager.getActivityState(act,vehicle2, id, Double.class));
View Full Code Here

     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build pickups and deliveries at the required locations, each with a capacity-demand of 1.
     */
    Pickup pickup1 = (Pickup) Pickup.Builder.newInstance("1").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(5, 7)).build();
View Full Code Here

   
    int depotCounter = 1;
    for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){
      for(int i=0;i<nuOfVehicles;i++){
        VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type").addCapacityDimension(0, capacity).setCostPerDistance(1.0).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setStartLocationCoordinate(depotCoord).setType(vehicleType).build();
        vrpBuilder.addVehicle(vehicle);
      }
      depotCounter++;
    }
   
View Full Code Here

TOP

Related Classes of jsprit.core.problem.vehicle.VehicleImpl$NoVehicle

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.