Package rinde.sim.util

Examples of rinde.sim.util.TimeWindow


    final ScenarioBuilder sb = new ScenarioBuilder(PDPScenarioEvent.ADD_DEPOT,
        PDPScenarioEvent.ADD_PARCEL, PDPScenarioEvent.ADD_VEHICLE,
        PDPScenarioEvent.TIME_OUT);

    sb.addEvent(new AddVehicleEvent(100, new VehicleDTO(new Point(7, 7), 7d, 2,
        new TimeWindow(0, 1000L))));
    sb.addEvent(new AddDepotEvent(76, new Point(3, 3)));
    sb.addEvent(new AddVehicleEvent(125, new VehicleDTO(new Point(6, 9), 3d, 1,
        new TimeWindow(500, 10000L))));
    sb.addEvent(new AddParcelEvent(ParcelDTO
        .builder(new Point(0, 0), new Point(1, 1))
        .pickupTimeWindow(new TimeWindow(2500, 10000))
        .deliveryTimeWindow(new TimeWindow(5000, 10000))
        .neededCapacity(0)
        .arrivalTime(2400)
        .pickupDuration(200)
        .deliveryDuration(800)
        .build()));
    sb.addEvent(new TimedEvent(PDPScenarioEvent.TIME_OUT, 200000));

    final VanLon14Scenario s = sb
        .build(new ScenarioCreator<VanLon14Scenario>() {
          @Override
          public VanLon14Scenario create(List<TimedEvent> eventList,
              Set<Enum<?>> eventTypes) {
            return new VanLon14Scenario(eventList, new TimeWindow(0, 10),
                new Point(0, 0), new Point(10, 10), 1000L,
                VanLon14.ExperimentClass.HIGH_LARGE, 0);
          }
        });
View Full Code Here


    final ScenarioBuilder sb = new ScenarioBuilder(PDPScenarioEvent.ADD_DEPOT,
        PDPScenarioEvent.ADD_PARCEL, PDPScenarioEvent.ADD_VEHICLE,
        PDPScenarioEvent.TIME_OUT);

    sb.addEvent(new AddVehicleEvent(100, new VehicleDTO(new Point(7, 7), 7d, 2,
        new TimeWindow(0, 1000L))));
    sb.addEvent(new AddDepotEvent(76, new Point(3, 3)));
    sb.addEvent(new AddVehicleEvent(125, new VehicleDTO(new Point(6, 9), 3d, 1,
        new TimeWindow(500, 10000L))));
    sb.addEvent(new AddParcelEvent(new ParcelDTO(new Point(0, 0), new Point(1,
        1), new TimeWindow(2500, 10000), new TimeWindow(5000, 10000), 0, 2400,
        200, 800)));
    sb.addEvent(new TimedEvent(PDPScenarioEvent.TIME_OUT, 200000));

    final TestScenario s = sb.build(new ScenarioCreator<TestScenario>() {
      @Override
      public TestScenario create(List<TimedEvent> eventList,
          Set<Enum<?>> eventTypes) {
        return new TestScenario(eventList, new TimeWindow(0, 1000), 1000L, SI
            .MILLI(SI.SECOND), TestProblemClass.TEST);
      }
    });

    final String res = ScenarioIO.write(s);
View Full Code Here

  @Test
  public void overridingTest() {
    final ParcelDTO.Builder b = ParcelDTO.builder(new Point(0, 0),
        new Point(2, 2));

    final ParcelDTO dto1 = b.timeWindows(new TimeWindow(7, 10)).build();
    assertEquals(new TimeWindow(7, 10), dto1.pickupTimeWindow);
    assertEquals(new TimeWindow(7, 10), dto1.deliveryTimeWindow);

    final ParcelDTO dto2 = b.pickupTimeWindow(new TimeWindow(8, 11)).build();
    assertEquals(new TimeWindow(8, 11), dto2.pickupTimeWindow);
    assertEquals(new TimeWindow(7, 10), dto2.deliveryTimeWindow);

    final ParcelDTO dto3 = b.serviceDuration(560L).build();
    assertEquals(new TimeWindow(8, 11), dto3.pickupTimeWindow);
    assertEquals(new TimeWindow(7, 10), dto3.deliveryTimeWindow);
    assertEquals(560, dto3.pickupDuration);
    assertEquals(560, dto3.deliveryDuration);

    final ParcelDTO dto4 = b.pickupDuration(230L).build();
    assertEquals(230, dto4.pickupDuration);
View Full Code Here

   */
  @Test
  public void convertDecompositionTest() {
    final VehicleDTO vd1 = new VehicleDTO(
        new Point(5, 5), 30, 0,
        new TimeWindow(100L, 100000L));

    final ParcelDTO a = ParcelDTO.builder(new Point(0, 0), new Point(10, 10))
        .pickupTimeWindow(new TimeWindow(0, 30))
        .deliveryTimeWindow(new TimeWindow(70, 80))
        .pickupDuration(5000L)
        .deliveryDuration(10000L)
        .build();

    final ParcelDTO b = ParcelDTO.builder(new Point(5, 0), new Point(10, 7))
        .pickupTimeWindow(new TimeWindow(0, 30))
        .deliveryTimeWindow(new TimeWindow(70, 80))
        .pickupDuration(5000L)
        .deliveryDuration(10000L)
        .build();

    final ParcelDTO c = ParcelDTO.builder(new Point(3, 0), new Point(6, 7))
        .pickupTimeWindow(new TimeWindow(0, 30))
        .deliveryTimeWindow(new TimeWindow(70, 80))
        .pickupDuration(5000L)
        .deliveryDuration(10000L)
        .build();

    final ParcelDTO d = ParcelDTO.builder(new Point(3, 0), new Point(6, 2))
        .pickupTimeWindow(new TimeWindow(0, 30))
        .deliveryTimeWindow(new TimeWindow(70, 80))
        .pickupDuration(5000L)
        .deliveryDuration(10000L)
        .build();

    final ImmutableSet<ParcelDTO> availableParcels = ImmutableSet
View Full Code Here

  @Test
  public void testLoad1() {
    // distance is 1 km which is traveled in 2 minutes with 30km/h
    final ParcelDTO dto = ParcelDTO.builder(new Point(0, 0), new Point(0, 1))
        .pickupTimeWindow(new TimeWindow(0, 10))
        .deliveryTimeWindow(new TimeWindow(10, 20))
        .neededCapacity(0)
        .arrivalTime(0)
        .serviceDuration(5)
        .build();
View Full Code Here

  @Test
  public void testLoad2() {
    // distance is 10km which is travelled in 20 minutes with 30km/h
    final ParcelDTO dto = ParcelDTO.builder(new Point(0, 0), new Point(0, 10))
        .pickupTimeWindow(new TimeWindow(15, 15))
        .deliveryTimeWindow(new TimeWindow(15, 15))
        .neededCapacity(0)
        .arrivalTime(0)
        .serviceDuration(5)
        .build();
View Full Code Here

  @Test
  public void testLoad3() {
    // distance is 3 km which is traveled in 6 minutes with 30km/h
    final ParcelDTO dto = new ParcelDTO(new Point(0, 0), new Point(0, 3),
        new TimeWindow(10, 30), new TimeWindow(50, 75), 0, 0, 5, 5);

    final List<LoadPart> parts = measureLoad(new AddParcelEvent(dto), 30);
    assertEquals(3, parts.size());

    // pickup load in [10,35), duration is 5 minutes, so load is 5/25 = 6/30
View Full Code Here

    assertSame(p1.dto, res.state.vehicles.get(0).destination);
    assertEquals(v1.getServiceState(), v1.getState());
  }

  static DefaultParcel createParcel(Point origin, Point dest) {
    return new DefaultParcel(new ParcelDTO(origin, dest, new TimeWindow(380001,
        380002), new TimeWindow(0, 1000), 0, 0, 3000, 3000));
  }
View Full Code Here

  }

  static class TestVehicle extends RouteFollowingVehicle {

    TestVehicle(Point start) {
      super(new VehicleDTO(start, 30, 1, new TimeWindow(0, 1000)), false);
    }
View Full Code Here

    final Point depotPosition = new Point(2.0, 2.5);
    final double truckSpeed = 30;
    sb.addEvent(new AddDepotEvent(-1, depotPosition));
    for (int i = 0; i < vehicles; i++) {
      sb.addEvent(new AddVehicleEvent(-1, new VehicleDTO(depotPosition,
          truckSpeed, 0, new TimeWindow(0, totalTime))));
    }
    sb.addEvents(parcels.get(online));
    sb.addEvent(new TimedEvent(TIME_OUT, totalTime));

    return sb.build(new ScenarioCreator<Gendreau06Scenario>() {
View Full Code Here

TOP

Related Classes of rinde.sim.util.TimeWindow

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.