Package rinde.sim.pdptw.common

Examples of rinde.sim.pdptw.common.AddParcelEvent


    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)
View Full Code Here


        .neededCapacity(0)
        .arrivalTime(0)
        .serviceDuration(5)
        .build();

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

    // pickup load in [0,15), duration is 5 minutes, so load is 5/15 = 1/3
    assertEquals(0, parts.get(0).begin());
    assertEquals(1 / 3d, parts.get(0).get(0), EPSILON);
View Full Code Here

        .neededCapacity(0)
        .arrivalTime(0)
        .serviceDuration(5)
        .build();

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

    // pickup load in [15,20), duration is 5 minutes, so load is 5/5 = 1
    assertEquals(15, parts.get(0).begin());
    assertEquals(1d, parts.get(0).get(15), EPSILON);
View Full Code Here

  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
    assertEquals(10, parts.get(0).begin());
    assertEquals(6 / 30d, parts.get(0).get(10), EPSILON);
View Full Code Here

              .neededCapacity(PARCEL_MAGNITUDE)
              .arrivalTime(arrTime)
              .pickupDuration(pickupServiceTime)
              .deliveryDuration(deliveryServiceTime)
              .build();
          listBuilder.add(new AddParcelEvent(dto));
        }
      }
      reader.close();
    } catch (final IOException e) {
      throw new IllegalArgumentException(e);
View Full Code Here

          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));
    }
    ordersFileReader.close();

    return sb.build(new ScenarioCreator<FabriRechtScenario>() {
      @Override
View Full Code Here

            .getAsJsonObject().get("position"), Point.class));
      case ADD_VEHICLE:
        return new AddVehicleEvent(time, (VehicleDTO) context.deserialize(json
            .getAsJsonObject().get("vehicleDTO"), VehicleDTO.class));
      case ADD_PARCEL:
        return new AddParcelEvent((ParcelDTO) context.deserialize(json
            .getAsJsonObject().get("parcelDTO"), ParcelDTO.class));
      case TIME_OUT:
        return new TimedEvent(type, time);
      }
      throw new IllegalStateException();
View Full Code Here

    long reactionTime = 0;
    int count = 0;
    for (final TimedEvent ev : s.asList()) {
      if (ev instanceof AddParcelEvent) {
        final AddParcelEvent ape = (AddParcelEvent) ev;
        reactionTime += ape.parcelDTO.pickupTimeWindow.end - ape.time;
        count++;
      }
    }
    return reactionTime / (double) count;
View Full Code Here

    for (final long time : times) {
      final Point pickup = locations.get(index++);
      final Point delivery = locations.get(index++);
      final ImmutableList<TimeWindow> tws = timeWindowGenerator.generate(time,
          pickup, delivery, rng);
      sb.addEvent(new AddParcelEvent(
          ParcelDTO.builder(pickup, delivery)
              .pickupTimeWindow(tws.get(0))
              .deliveryTimeWindow(tws.get(1))
              .neededCapacity(0)
              .arrivalTime(time)
View Full Code Here

  }

  @Test
  public void simpleScenario() throws IOException {
    final Gendreau06Scenario scenario = create(2, minutes(15),
        new AddParcelEvent(new ParcelDTO(new Point(2, 1), new Point(4, 1),
            new TimeWindow(0, 720000), new TimeWindow(5, 720000), 0, 0, 0, 0)));
    final StatisticsDTO dto = runProblem(scenario, useGui);

    // the second truck will turn around just one tick distance before
    // reaching the package. the reason is that it is too late since the
View Full Code Here

TOP

Related Classes of rinde.sim.pdptw.common.AddParcelEvent

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.