Examples of Capacity


Examples of jsprit.core.problem.Capacity

    }
    return newVehicle.getType().getVehicleCostParams().fix - currentFix;
  }

  private double getDeltaRelativeFixCost(VehicleRoute route, Vehicle newVehicle, Job job) {
    Capacity currentLoad = getCurrentMaxLoadInRoute(route);
//    int currentLoad = getCurrentMaxLoadInRoute(route);
    Capacity load = Capacity.addup(currentLoad, job.getSize());
//    double load = currentLoad + job.getCapacityDemand();
    double currentRelFix = 0.0;
    if(route.getVehicle() != null){
      if(!(route.getVehicle() instanceof NoVehicle)){
        currentRelFix += route.getVehicle().getType().getVehicleCostParams().fix * Capacity.divide(currentLoad, route.getVehicle().getType().getCapacityDimensions());
View Full Code Here

Examples of jsprit.core.problem.Capacity

    double relativeFixCost = newVehicle.getType().getVehicleCostParams().fix* (Capacity.divide(load, newVehicle.getType().getCapacityDimensions())) - currentRelFix;
    return relativeFixCost;
  }

  private Capacity getCurrentMaxLoadInRoute(VehicleRoute route) {
        Capacity maxLoad = stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class);
        if(maxLoad == null) maxLoad = Capacity.Builder.newInstance().build();
        return  maxLoad;
  }
View Full Code Here

Examples of jsprit.core.problem.Capacity

            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity atBeginning = analyser.getCapacityViolationAtBeginning(route);
        for(int i=0;i<atBeginning.getNuOfDimensions();i++){
            assertTrue(atBeginning.get(i) == 0);
        }
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity atEnd = analyser.getCapacityViolationAtEnd(route);
        for(int i=0;i<atEnd.getNuOfDimensions();i++){
            assertTrue(atEnd.get(i) == 0);
        }
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity cap = analyser.getCapacityViolation(route);
        assertEquals(50,cap.get(0));
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity atEnd = analyser.getCapacityViolationAtEnd(route);
        assertEquals(5,atEnd.get(0));
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        TourActivity act = route.getStart();
        Capacity cap = analyser.getCapacityViolationAfterActivity(act,route);
        for(int i=0;i<cap.getNuOfDimensions();i++){
            assertTrue(cap.get(i) == 0);
        }
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity cap = analyser.getCapacityViolationAtBeginning(route);
        assertEquals(25,cap.get(0));
    }
View Full Code Here

Examples of jsprit.core.problem.Capacity

  }
 
  @Test(expected=IllegalStateException.class)
  public void whenShipmentIsPickedDeliveredAndDeliveredAgain_throwsException(){
    Shipment s = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(mock(Vehicle.class), mock(Driver.class));
    builder.addPickup(s);
    builder.addDelivery(s);
    builder.addDelivery(s);
View Full Code Here

Examples of jsprit.core.problem.Capacity

  }
 
  @Test(expected=IllegalStateException.class)
  public void whenShipmentIsPickedUpThoughButHasNotBeenDeliveredAndRouteIsBuilt_throwsException(){
    Shipment s = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
        Shipment s2 = mock(Shipment.class);
        when(s2.getSize()).thenReturn(capacity);
    when(s.getSize()).thenReturn(capacity);
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(mock(Vehicle.class), mock(Driver.class));
    builder.addPickup(s);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.