Package rinde.sim.util

Examples of rinde.sim.util.TimeWindow


          // when an offline scenario is desired, all times are set to -1
          final long arrTime = online ? requestArrivalTime : -1;

          final ParcelDTO dto = ParcelDTO.builder(new Point(pickupX, pickupY),
              new Point(deliveryX, deliveryY)).
              pickupTimeWindow(new TimeWindow(
                  pickupTimeWindowBegin, pickupTimeWindowEnd))
              .deliveryTimeWindow(new TimeWindow(
                  deliveryTimeWindowBegin, deliveryTimeWindowEnd))
              .neededCapacity(PARCEL_MAGNITUDE)
              .arrivalTime(arrTime)
              .pickupDuration(pickupServiceTime)
              .deliveryDuration(deliveryServiceTime)
View Full Code Here


    final ModelProvider mp = new TestModelProvider(new ArrayList<Model<?>>(
        asList(rm, pm)));
    rm.registerModelProvider(mp);
    pm.registerModelProvider(mp);

    final VehicleDTO v = new VehicleDTO(new Point(1, 1), 30, 1, new TimeWindow(
        0, minute(30)));
    d = new RouteFollowingVehicle(v, allowDelayedRouteChanges);
    d2 = new RouteFollowingVehicle(v, allowDelayedRouteChanges);

    p1 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 2), new Point(1, 4))
        .pickupTimeWindow(new TimeWindow(minute(5), minute(15)))
        .deliveryTimeWindow(new TimeWindow(minute(16), minute(30)))
        .pickupDuration(minute(3))
        .deliveryDuration(minute(1))
        .build());

    p2 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 3), new Point(1, 5))
        .pickupTimeWindow(new TimeWindow(minute(15) + 10, minute(25)))
        .deliveryTimeWindow(new TimeWindow(minute(22) + 10, minute(30)))
        .deliveryDuration(minute(3))
        .build());

    p3 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 3), new Point(1, 5))
        .pickupTimeWindow(new TimeWindow(minute(15) + 10, minute(25)))
        .deliveryTimeWindow(new TimeWindow(minute(22) + 10, minute(30)))
        .serviceDuration(minute(3))
        .build());

    depot = new DefaultDepot(new Point(3, 5));
    if (register) {
View Full Code Here

   */
  @Test
  public void tooEarlyTest1() {
    final DefaultParcel p4 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 2), new Point(1, 4))
        .pickupTimeWindow(new TimeWindow(minute(5) + second(30), minute(15)))
        .deliveryTimeWindow(new TimeWindow(minute(16), minute(30)))
        .pickupDuration(minute(3))
        .deliveryDuration(minute(1))
        .build());

    PDPTWTestUtil.register(rm, pm, p4);
View Full Code Here

   */
  @Test
  public void tooEarlyTest2() {
    final DefaultParcel p4 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 2.2), new Point(1, 4))
        .pickupTimeWindow(new TimeWindow(minute(5) + second(30), minute(15)))
        .deliveryTimeWindow(new TimeWindow(minute(16), minute(30)))
        .pickupDuration(minute(3))
        .deliveryDuration(minute(1))
        .build());

    PDPTWTestUtil.register(rm, pm, p4);
View Full Code Here

   */
  @Test
  public void tooEarlyTest3() {
    final DefaultParcel p4 = new DefaultParcel(ParcelDTO
        .builder(new Point(1, 1.99), new Point(1, 4))
        .pickupTimeWindow(new TimeWindow(minute(5) + second(30), minute(15)))
        .deliveryTimeWindow(new TimeWindow(minute(16), minute(30)))
        .pickupDuration(minute(3))
        .deliveryDuration(minute(1))
        .build());

    PDPTWTestUtil.register(rm, pm, p4);
View Full Code Here

  /**
   * Tests a subclass that changes the state machine.
   */
  @Test
  public void testExtension() {
    final VehicleDTO v = new VehicleDTO(new Point(1, 1), 30, 1, new TimeWindow(
        0, minute(30)));
    final SubVehicle vehicle = new SubVehicle(v, allowDelayedRouteChanges);
    d = vehicle;

    PDPTWTestUtil.register(rm, pm, vehicle);
View Full Code Here

    @Override
    public VanLon14Scenario create(List<TimedEvent> events,
        ScenarioGenerator<VanLon14Scenario> generator, int instanceNumber) {

      final TimeWindow tw = new TimeWindow(0, generator.getScenarioLength());
      final Point min = generator.getMinPoint();
      final Point max = generator.getMaxPoint();
      final long tickSize = generator.getTickSize();
      return new VanLon14Scenario(events, tw, min, max, tickSize, pc,
          instanceNumber);
View Full Code Here

  @Test
  public void convertTWtest() {
    final UnitConverter timeConverter = MILLI(SECOND).getConverterTo(SECOND);

    final int[] tw1 = convertTW(new TimeWindow(300, 800), 5, timeConverter);
    assertEquals(0, tw1[0]);
    assertEquals(1, tw1[1]);

    final int[] tw2 = convertTW(new TimeWindow(7300, 8800), 0, timeConverter);
    assertEquals(8, tw2[0]);
    assertEquals(8, tw2[1]);

    final int[] tw3 = convertTW(new TimeWindow(7300, 8800), 7300, timeConverter);
    assertEquals(0, tw3[0]);
    assertEquals(1, tw3[1]);
  }
View Full Code Here

    sim.register(new PDPRoadModel(new PlaneRoadModel(new Point(0, 0),
        new Point(10, 10), 50), false));
    sim.configure();

    final RouteFollowingVehicle rfv = new RouteFollowingVehicle(new VehicleDTO(
        new Point(1, 1), 50, 10, new TimeWindow(0, 1000000)), false);
    final Depot depot = new DefaultDepot(new Point(5, 5));

    final DefaultParcel dp1 = new DefaultParcel(new ParcelDTO(new Point(2, 2),
        new Point(3, 3), new TimeWindow(0, 1000), new TimeWindow(0, 1000), 0,
        0L, 5L, 5L));
    final DefaultParcel dp2 = new DefaultParcel(new ParcelDTO(new Point(2, 2),
        new Point(3, 3), new TimeWindow(0, 1000), new TimeWindow(0, 1000), 0,
        0L, 5L, 5L));

    sim.register(depot);
    sim.register(rfv);
    sim.register(dp1);
View Full Code Here

    final String[] firstLine = ordersFileReader.readLine().split(";");
    final int numVehicles = Integer.parseInt(firstLine[0]);
    final int capacity = Integer.parseInt(firstLine[1]);
    final long startTime = Long.parseLong(firstLine[2]);
    final long endTime = Long.parseLong(firstLine[3]);
    final TimeWindow timeWindow = new TimeWindow(startTime, endTime);

    sb.addEvent(new TimedEvent(PDPScenarioEvent.TIME_OUT, endTime));

    // for (int i = 0; i < numVehicles; i++) {
    // sb.addEvent(new AddVehicleEvent(0, new VehicleDTO(coordinates.get(0),
    // 1.0, capacity, timeWindow)));
    // }
    final VehicleDTO defaultVehicle = new VehicleDTO(coordinates.get(0), 1.0,
        capacity, timeWindow);

    // Nr. des Pickup-Orts; Nr. des Delivery-Orts; untere Zeitfenstergrenze
    // Pickup; obere Zeitfenstergrenze Pickup; untere Zeitfenstergrenze
    // Delivery; obere Zeitfenstergrenze Delivery; benötigte Kapazität;
    // Anrufzeit; Servicezeit Pickup; Servicezeit Delivery
    while ((line = ordersFileReader.readLine()) != null) {
      final String[] parts = line.split(";");

      final int neededCapacity = 1; // Integer.parseInt(parts[6]);

      final ParcelDTO o = new ParcelDTO(coordinates.get(Integer
          .parseInt(parts[0])), coordinates.get(Integer.parseInt(parts[1])),
          new TimeWindow(Long.parseLong(parts[2]), Long.parseLong(parts[3])),
          new TimeWindow(Long.parseLong(parts[4]), Long.parseLong(parts[5])),
          neededCapacity, Long.parseLong(parts[7]), Long.parseLong(parts[8]),
          Long.parseLong(parts[9]));

      sb.addEvent(new AddParcelEvent(o));
    }
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.