Esempio n. 1
0
 @Test
 public void loadAtBeginningShouldBe0() {
   stateManager.informInsertionStarts(Arrays.asList(serviceRoute), Collections.<Job>emptyList());
   Capacity routeState =
       stateManager.getRouteState(serviceRoute, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
   assertEquals(0, routeState.get(0));
 }
Esempio n. 2
0
  /*
  shipment_route
  shipment1 10
  shipment2 15
  pick1_pick2_deliver2_deliver1

   */
  @Test
  public void when_shipmentroute_loadAtEndShouldBe0() {
    stateManager.informInsertionStarts(Arrays.asList(shipment_route), Collections.<Job>emptyList());
    Capacity routeState =
        stateManager.getRouteState(shipment_route, InternalStates.LOAD_AT_END, Capacity.class);
    assertEquals(0, routeState.get(0));
  }
Esempio n. 3
0
 private Double getLastTransport(TourActivity activity, VehicleRoute route, StateId id) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   if (activity == null) throw new IllegalArgumentException("activity is missing.");
   if (activity instanceof Start) return 0.;
   if (activity instanceof End) return stateManager.getRouteState(route, id, Double.class);
   verifyThatRouteContainsAct(activity, route);
   return stateManager.getActivityState(activity, id, Double.class);
 }
Esempio n. 4
0
 @Test
 public void when_pdroute_loadAtBeginningShouldBe5() {
   stateManager.informInsertionStarts(
       Arrays.asList(pickup_delivery_route), Collections.<Job>emptyList());
   Capacity routeState =
       stateManager.getRouteState(
           pickup_delivery_route, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
   assertEquals(5, routeState.get(0));
 }
Esempio n. 5
0
 /**
  * @param route to get the total waiting time from
  * @return total waiting time of this route, i.e. sum of waiting times at activities. Returns null
  *     if no waiting time value exists for the specified route
  */
 public Double getWaitingTime(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(route, waiting_time_id, Double.class);
 }
Esempio n. 6
0
 /**
  * Returns true, if shipment constraint is violated. Two activities are associated to a shipment:
  * pickupShipment and deliverShipment. If both shipments are not in the same route OR
  * deliverShipment occurs before pickupShipment then the shipment constraint is violated.
  *
  * @param route to check the shipment constraint.
  * @return true if violated, false otherwise. Null if no state can be found or specified route is
  *     null.
  */
 public Boolean hasShipmentConstraintViolation(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(route, shipment_id, Boolean.class);
 }
Esempio n. 7
0
 /**
  * @param route to get the time window violation from
  * @return time violation of route, i.e. sum of individual activity time window violations.
  */
 public Double getTimeWindowViolation(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(route, too_late_id, Double.class);
 }
Esempio n. 8
0
 /**
  * @param route to get delivered load from
  * @return delivered laod (without load at end)
  */
 public Capacity getLoadDelivered(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(
       route, stateManager.createStateId(LOAD_DELIVERED), Capacity.class);
 }
Esempio n. 9
0
 /**
  * @param route to get number of deliveries from
  * @return number of deliveries delivered on specified route (without load at end)
  */
 public Integer getNumberOfDeliveries(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(
       route, stateManager.createStateId(DELIVERY_COUNT), Integer.class);
 }
Esempio n. 10
0
 /**
  * @param route to get max load from
  * @return max load of specified route, i.e. for each capacity dimension the max value.
  */
 public Capacity getMaxLoad(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(route, InternalStates.MAXLOAD, Capacity.class);
 }
Esempio n. 11
0
 /**
  * @param route to get the load at beginning from
  * @return load at start location of specified route
  */
 public Capacity getLoadAtBeginning(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
 }
Esempio n. 12
0
 /**
  * @param route to get the number of pickups at beginning from
  * @return number of pickups at beginning
  */
 public Integer getNumberOfPickupsAtBeginning(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   return stateManager.getRouteState(
       route, stateManager.createStateId(PICKUP_COUNT_AT_BEGINNING), Integer.class);
 }
Esempio n. 13
0
  /**
   * @param route to get the transport costs from
   * @return total variable transport costs of route, i.e. sum of transport costs specified by
   *     vrp.getTransportCosts().getTransportCost(fromId,toId,...)
   */
  public Double getVariableTransportCosts(VehicleRoute route) {
    if (route == null) throw new IllegalArgumentException("route is missing.");

    return stateManager.getRouteState(route, InternalStates.COSTS, Double.class);
  }