org.matsim.contrib.dvrp.fleet.DvrpVehicle Java Examples

The following examples show how to use org.matsim.contrib.dvrp.fleet.DvrpVehicle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VehicleToVSGenerator.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List<DvrpVehicleSpecification> generateVehicles() {
    int generatedNumberOfVehicles = 0;
    List<DvrpVehicleSpecification> vehicles = new LinkedList<>();
    placedVehicles = Array.zeros(virtualNetwork.getvNodesCount());

    while (generatedNumberOfVehicles < operatorConfig.getGeneratorConfig().getNumberOfVehicles()) {
        ++generatedNumberOfVehicles;
        int vNodeIndex = getNextVirtualNode();
        Link linkGen = getNextLink(virtualNetwork.getVirtualNode(vNodeIndex));
        /** update placedVehicles */
        placedVehicles.set(RealScalar.ONE::add, vNodeIndex);
        Id<DvrpVehicle> id = AmodeusIdentifiers.createVehicleId(operatorConfig.getMode(), generatedNumberOfVehicles);
        vehicles.add(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(id) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(capacity) //
                .startLinkId(linkGen.getId()) //
                .build());
    }
    return vehicles;
}
 
Example #2
Source File: DemoGenerator.java    From amod with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List<DvrpVehicleSpecification> generateVehicles() {
    long generatedVehicles = 0;
    List<DvrpVehicleSpecification> vehicles = new LinkedList<>();
    while (generatedVehicles < operatorConfig.getGeneratorConfig().getNumberOfVehicles()) {
        ++generatedVehicles;

        /** select one of the 10 random links for placement */
        int elemRand = MatsimRandom.getRandom().nextInt(randomLinks.size());
        Link linkSel = randomLinks.stream().skip(elemRand).findFirst().get();

        LOGGER.info("car placed at link " + linkSel);

        Id<DvrpVehicle> id = AmodeusIdentifiers.createVehicleId(operatorConfig.getMode(), generatedVehicles);

        vehicles.add(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(id) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(capacity) //
                .startLinkId(linkSel.getId()) //
                .build());
    }
    return vehicles;
}
 
Example #3
Source File: AmodeusModeQSimModule.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Fleet get() {
    AmodeusGenerator generator = getModalInstance(AmodeusGenerator.class);
    Network network = getModalInstance(Network.class);

    List<DvrpVehicleSpecification> specifications = generator.generateVehicles();
    List<DvrpVehicle> vehicles = new LinkedList<>();

    for (DvrpVehicleSpecification specification : specifications) {
        if (Double.isFinite(specification.getServiceEndTime())) {
            throw new IllegalStateException("AV vehicles must have infinite service time");
        }

        vehicles.add(new DvrpVehicleImpl(specification, network.getLinks().get(specification.getStartLinkId())));
    }

    for (DvrpVehicle vehicle : vehicles) {
        vehicle.getSchedule().addTask(new AmodeusStayTask(vehicle.getServiceBeginTime(), vehicle.getServiceEndTime(), vehicle.getStartLink()));
    }

    return () -> vehicles.stream().collect(ImmutableMap.toImmutableMap(DvrpVehicle::getId, v -> v));
}
 
Example #4
Source File: AmodeusPickupActivity.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
public AmodeusPickupActivity(PassengerEngine passengerEngine, DynAgent driver, DvrpVehicle vehicle, Map<Id<Request>, PassengerRequest> requests, double expectedEndTime,
        double durationPerPassenger) {
    super(ACTIVITY_TYPE);

    this.expectedEndTime = expectedEndTime;
    this.durationPerPassenger = durationPerPassenger;

    this.passengerEngine = passengerEngine;
    this.driver = driver;

    this.requests = requests;

    if (requests.size() > vehicle.getCapacity()) {
        throw new IllegalStateException("Number of requests exceeds number of seats");
    }
}
 
Example #5
Source File: AmodeusActionCreator.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
@Override
public DynAction createAction(DynAgent dynAgent, DvrpVehicle vehicle, double now) {
    Task task = vehicle.getSchedule().getCurrentTask();

    switch ((AmodeusTaskType) task.getTaskType()) {
    case PICKUP:
        AmodeusPickupTask mpt = (AmodeusPickupTask) task;

        double expectedEndTime = now + timingConfig.getMinimumPickupDurationPerStop();
        double durationPerPassenger = timingConfig.getPickupDurationPerPassenger();

        return new AmodeusPickupActivity(passengerEngine, dynAgent, vehicle, mpt.getRequests(), expectedEndTime, durationPerPassenger);
    case DROPOFF:
        AmodeusDropoffTask mdt = (AmodeusDropoffTask) task;
        double endTime = now + Math.max(timingConfig.getMinimumDropoffDurationPerStop(), mdt.getRequests().size() * timingConfig.getDropoffDurationPerPassenger());

        return new AmodeusDropoffActivity(passengerEngine, dynAgent, vehicle, mdt.getRequests(), endTime);
    case DRIVE:
        return legFactory.create(vehicle);
    case STAY:
        return new AmodeusStayActivity((AmodeusStayTask) task);
    default:
        throw new IllegalStateException();
    }
}
 
Example #6
Source File: Warmstarter.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
public Warmstarter(double[][] costMatrix, List<Id<DvrpVehicle>> taxis, List<PassengerRequest> requests) {
    this.costMatrix = costMatrix;
    rowDim = costMatrix.length;
    colDim = costMatrix[0].length;
    dim = Math.max(rowDim, colDim);
    xLabel = new double[dim];
    yLabel = new double[dim];
    yMatch = new int[dim];
    xMatch = new int[dim];
    newMatching = new int[dim];
    Arrays.fill(newMatching, UNASSIGNED);
    Arrays.fill(yMatch, UNASSIGNED);
    Arrays.fill(xMatch, UNASSIGNED);

    if (readyForWarmstart()) {
        setNewMatching(taxis, requests);
        matchAndLabel();
        setLabelsForFreeJobs();
        hasResult = true;
    }
    lastTaxis = taxis;
    lastRequests = requests;
}
 
Example #7
Source File: CreateFleetVehicles.java    From matsim-maas with GNU General Public License v2.0 6 votes vote down vote up
private void run() {

		Scenario scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig());
		new MatsimNetworkReader(scenario.getNetwork()).readFile(networkFile.toString());
		final int[] i = {0};
		Stream<DvrpVehicleSpecification> vehicleSpecificationStream = scenario.getNetwork().getLinks().entrySet().stream()
				.filter(entry -> entry.getValue().getAllowedModes().contains(TransportMode.car)) // drt can only start on links with Transport mode 'car'
				.sorted((e1, e2) -> (random.nextInt(2) - 1)) // shuffle links
				.limit(numberOfVehicles) // select the first *numberOfVehicles* links
				.map(entry -> ImmutableDvrpVehicleSpecification.newBuilder()
						.id(Id.create("drt_" + i[0]++, DvrpVehicle.class))
						.startLinkId(entry.getKey())
						.capacity(seatsPerVehicle)
						.serviceBeginTime(operationStartTime)
						.serviceEndTime(operationEndTime)
						.build());

		new FleetWriter(vehicleSpecificationStream).write(outputFile.toString());
	}
 
Example #8
Source File: RandomDensityGenerator.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List<DvrpVehicleSpecification> generateVehicles() {
    long generatedVehicles = 0;
    List<DvrpVehicleSpecification> vehicles = new LinkedList<>();
    while (generatedVehicles < operatorConfig.getGeneratorConfig().getNumberOfVehicles()) {
        ++generatedVehicles;

        int bound = network.getLinks().size();
        int elemRand = MatsimRandom.getRandom().nextInt(bound);
        Link link = network.getLinks().values().stream().skip(elemRand).findFirst().get();
        LOGGER.info("car placed at link " + link);

        Id<DvrpVehicle> id = AmodeusIdentifiers.createVehicleId(operatorConfig.getMode(), generatedVehicles);
        vehicles.add(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(id) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(capacity) //
                .startLinkId(link.getId()) //
                .build());
    }
    return vehicles;
}
 
Example #9
Source File: SingleRideAppender.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
public AppendTask(PassengerRequest request, DvrpVehicle vehicle, double time, Future<Path> pickup, Future<Path> dropoff) {
    this.request = request;
    this.vehicle = vehicle;
    this.pickup = pickup;
    this.dropoff = dropoff;
    this.time = time;
}
 
Example #10
Source File: SingleFIFODispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onNextTaskStarted(DvrpVehicle vehicle) {
    Task task = vehicle.getSchedule().getCurrentTask();
    if (task.getTaskType() == AmodeusTaskType.STAY) {
        availableVehicles.add(vehicle);
    }
}
 
Example #11
Source File: RoboTaxi.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
/** Standard constructor
 * 
 * @param avVehicle binding association to MATSim AVVehicle object
 * @param divertableLinkTime
 * @param driveDestination
 * @param usageType */
/* package */ RoboTaxi(DvrpVehicle avVehicle, LinkTimePair divertableLinkTime, Link driveDestination, RoboTaxiUsageType usageType) {
    this.avVehicle = avVehicle;
    this.divertableLinkTime = divertableLinkTime;
    this.driveDestination = Objects.requireNonNull(driveDestination);
    this.directive = null;
    this.status = RoboTaxiStatus.STAY;
    this.usageType = usageType;
}
 
Example #12
Source File: MultiODHeuristic.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void reoptimize(double now) {
    SingleHeuristicDispatcher.HeuristicMode updatedMode = availableVehicles.size() > pendingRequests.size() ? SingleHeuristicDispatcher.HeuristicMode.OVERSUPPLY
            : SingleHeuristicDispatcher.HeuristicMode.UNDERSUPPLY;

    if (!updatedMode.equals(dispatcherMode)) {
        dispatcherMode = updatedMode;
        eventsManager.processEvent(new ModeChangeEvent(dispatcherMode, mode, now));
    }

    while (pendingRequests.size() > 0 && availableVehicles.size() > 0) {
        AggregatedRequest request = null;
        DvrpVehicle vehicle = null;

        switch (dispatcherMode) {
        case OVERSUPPLY:
            request = findRequest();
            vehicle = findClosestVehicle(request.getMasterRequest().getFromLink());
            break;
        case UNDERSUPPLY:
            vehicle = findVehicle();
            request = findClosestRequest(vehicleLinks.get(vehicle));
            break;
        }

        removeRequest(request);
        removeVehicle(vehicle);
        vehicle2Request.put(vehicle, request);

        assignableRequests.remove(request);
        appender.schedule(request, vehicle, now);
    }
}
 
Example #13
Source File: MultiODHeuristic.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onNextTaskStarted(DvrpVehicle vehicle) {
    Task task = vehicle.getSchedule().getCurrentTask();
    if (task.getTaskType() == AmodeusTaskType.PICKUP) {
        assignableRequests.remove(vehicle2Request.remove(vehicle));
    }

    if (task.getTaskType() == AmodeusTaskType.STAY) {
        addVehicle(vehicle, ((AmodeusStayTask) task).getLink());
    }
}
 
Example #14
Source File: SingleFIFODispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void reoptimize(double now) {
    while (availableVehicles.size() > 0 && pendingRequests.size() > 0) {
        DvrpVehicle vehicle = availableVehicles.poll();
        PassengerRequest request = pendingRequests.poll();
        appender.schedule(request, vehicle, now);
    }

    reoptimize = false;
}
 
Example #15
Source File: SingleHeuristicDispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onNextTaskStarted(DvrpVehicle vehicle) {
    Task task = vehicle.getSchedule().getCurrentTask();
    if (task.getTaskType() == AmodeusTaskType.STAY) {
        addVehicle(vehicle, ((AmodeusStayTask) task).getLink());
    }
}
 
Example #16
Source File: SingleHeuristicDispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void reoptimize(double now) {
    HeuristicMode updatedMode = availableVehicles.size() > pendingRequests.size() ? HeuristicMode.OVERSUPPLY : HeuristicMode.UNDERSUPPLY;

    if (!updatedMode.equals(dispatcherMode)) {
        dispatcherMode = updatedMode;
        eventsManager.processEvent(new ModeChangeEvent(dispatcherMode, mode, now));
    }

    while (pendingRequests.size() > 0 && availableVehicles.size() > 0) {
        PassengerRequest request = null;
        DvrpVehicle vehicle = null;

        switch (dispatcherMode) {
        case OVERSUPPLY:
            request = findRequest();
            vehicle = findClosestVehicle(request.getFromLink());
            break;
        case UNDERSUPPLY:
            vehicle = findVehicle();
            request = findClosestRequest(vehicleLinks.get(vehicle));
            break;
        }

        removeRequest(request);
        removeVehicle(vehicle);

        appender.schedule(request, vehicle, now);
    }
}
 
Example #17
Source File: PopulationDensityGenerator.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<DvrpVehicleSpecification> generateVehicles() {
    List<DvrpVehicleSpecification> vehicles = new LinkedList<>();
    Random random = new Random(randomSeed);

    int generatedNumberOfVehicles = 0;
    while (generatedNumberOfVehicles < numberOfVehicles) {
        generatedNumberOfVehicles++;

        // Multinomial selection
        double r = random.nextDouble();
        Link selectedLink = linkList.get(0);

        for (Link link : linkList) {
            if (r <= cumulativeDensity.get(link)) {
                selectedLink = link;
                break;
            }
        }

        Id<DvrpVehicle> id = AmodeusIdentifiers.createVehicleId(mode, generatedNumberOfVehicles);

        vehicles.add(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(id) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(capacity) //
                .startLinkId(selectedLink.getId()) //
                .build());
    }

    return vehicles;
}
 
Example #18
Source File: AmodeusDrtOptimizer.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void nextTask(DvrpVehicle vehicle) {
    Schedule schedule = vehicle.getSchedule();

    if (!schedule.getStatus().equals(Schedule.ScheduleStatus.STARTED)) {
        // We remove the first task, which is created by DRT ...
        schedule.removeLastTask();

        // ... and add the one we want for Amodeus.
        schedule.addTask(new AmodeusStayTask(vehicle.getServiceBeginTime(), Double.POSITIVE_INFINITY, vehicle.getStartLink()));
    }

    delegate.nextTask(vehicle);
}
 
Example #19
Source File: AmodeusDropoffActivity.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
public AmodeusDropoffActivity(PassengerEngine passengerEngine, DynAgent driver, DvrpVehicle vehicle, Map<Id<Request>, PassengerRequest> requests, double endTime) {
    super(ACTIVITY_TYPE);

    this.passengerEngine = passengerEngine;
    this.driver = driver;

    this.requests = requests;
    this.endTime = endTime;

    if (requests.size() > vehicle.getCapacity()) {
        // Number of requests exceeds number of seats
        throw new IllegalStateException();
    }
}
 
Example #20
Source File: BasicUniversalDispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
/** Adding a @param vehicle during setup of simulation handled by {@link AmodeusGenerator},
 * the parameter @param singleOrShared indicates if multi-passenger ride-sharing case
 * or unit capacity case. */
protected final void addVehicle(DvrpVehicle vehicle, RoboTaxiUsageType singleOrShared) {
    RoboTaxi roboTaxi = new RoboTaxi(vehicle, new LinkTimePair(vehicle.getStartLink(), 0.0), vehicle.getStartLink(), singleOrShared);
    Event event = new AVVehicleAssignmentEvent(dispatcherMode, vehicle.getId(), 0);
    addRoboTaxi(roboTaxi, event);
    tempLocationTrace.put(roboTaxi, new ArrayList<>());
}
 
Example #21
Source File: RunDrtTest.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
static public void createFleet(String path, int numberOfVehicles, Network network) {
    Random random = new Random(0);

    List<Link> links = network.getLinks().values().stream().filter(link -> link.getAllowedModes().contains("car")).collect(Collectors.toList());

    new FleetWriter(IntStream.range(0, 100).mapToObj(i -> {
        return ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(Id.create("drt" + i, DvrpVehicle.class)) //
                .startLinkId(links.get(random.nextInt(links.size())).getId()) //
                .capacity(4) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(30.0 * 3600.0) //
                .build();
    })).write(path);
}
 
Example #22
Source File: TestScenario.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<DvrpVehicleSpecification> generateVehicles() {
    VehicleType vehicleType = VehicleUtils.getDefaultVehicleType();
    vehicleType.getCapacity().setSeats(capacity);

    return Collections.singletonList(ImmutableDvrpVehicleSpecification.newBuilder() //
            .id(Id.create("vehicle", DvrpVehicle.class)) //
            .startLinkId(link.getId()) //
            .serviceBeginTime(0.0) //
            .serviceEndTime(Double.POSITIVE_INFINITY) //
            .capacity(capacity) //
            .build());
}
 
Example #23
Source File: Warmstarter.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void setNewMatching(List<Id<DvrpVehicle>> actTaxi, List<PassengerRequest> actRequest) {
    Id<DvrpVehicle> tmpTaxi = null;
    PassengerRequest tmpReq = null;
    int tmpTaxiId = UNASSIGNED;
    int last = UNASSIGNED;
    // List<Integer> taxiIDmatched = new ArrayList<>();
    // List<Integer> reqIDmatched = new ArrayList<>();

    for (int i = 0; i < lastTaxis.size(); i++) {
        tmpTaxi = lastTaxis.get(i);
        last = lastMatching[i];
        if (last >= lastRequests.size()) {
            continue;
        }
        tmpReq = lastRequests.get(last);
        if (!actTaxi.contains(tmpTaxi) || !actRequest.contains(tmpReq))
            continue; // Request is gone or taxi is gone or was matched to dummy job
        for (int j = 0; j < actTaxi.size(); j++) { // Find position of taxi in vector
            if (actTaxi.get(j).equals(tmpTaxi)) {
                tmpTaxiId = j;
                break;
            }
        }
        for (int j = 0; j < actRequest.size(); j++) {
            if (actRequest.get(j).equals(tmpReq)) {
                // taxiIDmatched.add(tmpTaxiId);
                // reqIDmatched.add(j);
                newMatching[tmpTaxiId] = j; // Find position of corresp request in vector
                break;
            }
        }
    }
    lastRequests = actRequest; // For next warmstart
    lastTaxis = actTaxi;
}
 
Example #24
Source File: ArtificialSharedScenarioCreator.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
public ArtificialSharedScenarioCreator(Config config) {

        LinkTimePair divertableLinkTime = new LinkTimePair(linkDepotOut, 0.0);

        Id<DvrpVehicle> idAv1 = Id.create("av1", DvrpVehicle.class);
        vehicle1 = new DvrpVehicleImpl(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(idAv1) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(3) //
                .startLinkId(linkDepotOut.getId()) //
                .build(), linkDepotOut);
        roboTaxi1 = new RoboTaxi(vehicle1, divertableLinkTime, linkDepotOut, RoboTaxiUsageType.SHARED);
        setFirstStayTask(vehicle1);

        Id<DvrpVehicle> idAv2 = Id.create("av2", DvrpVehicle.class);
        vehicle2 = new DvrpVehicleImpl(ImmutableDvrpVehicleSpecification.newBuilder() //
                .id(idAv2) //
                .serviceBeginTime(0.0) //
                .serviceEndTime(Double.POSITIVE_INFINITY) //
                .capacity(3) //
                .startLinkId(linkDepotOut.getId()) //
                .build(), linkDepotOut);
        roboTaxi2 = new RoboTaxi(vehicle2, divertableLinkTime, linkDepotOut, RoboTaxiUsageType.SHARED);
        setFirstStayTask(vehicle2);
        System.out.println("ArtificialScenario Created");
    }
 
Example #25
Source File: AmodeusOptimizer.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void prepareFirstTask(DvrpVehicle vehicle, Schedule schedule) {
    if (schedule.getTaskCount() != 1) {
        throw new IllegalStateException("Amodeus vehicle schedule should be empty initially.");
    }

    schedule.nextTask();
}
 
Example #26
Source File: AmodeusOptimizer.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void advanceSchedule(DvrpVehicle vehicle, Schedule schedule) {
    // Vehicle finished activity, so we can end the current task in the schedule.
    Task currentTask = schedule.getCurrentTask();
    currentTask.setEndTime(now);

    if (currentTask == Schedules.getLastTask(schedule)) {
        throw new IllegalStateException("An Amodeus schedule should never end!");
    }

    // Adjust begin and end time of the next tasks
    double startTime = now;
    Task nextTask = Schedules.getNextTask(schedule);

    for (int index = nextTask.getTaskIdx(); index < schedule.getTaskCount(); index++) {
        Task task = schedule.getTasks().get(index);

        if (task.getTaskType().equals(AmodeusTaskType.STAY)) {
            // Stay tasks should always end when planned (e.g. pre-planned trips)
            task.setEndTime(Math.max(task.getEndTime(), startTime));
        } else {
            // Other tasks are defined by duration, so we keep the planned duration intact
            task.setEndTime(now + (task.getEndTime() - task.getBeginTime()));
        }

        task.setBeginTime(startTime);
        startTime = task.getEndTime();
    }

    // Make sure schedule does not end and start next task
    ensureNonFinishingSchedule(schedule);
    schedule.nextTask();

    // Notify the dispatcher that a new task has started
    synchronized (dispatcher) {
        dispatcher.onNextTaskStarted(vehicle);
    }
}
 
Example #27
Source File: AmodeusOptimizer.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void nextTask(DvrpVehicle vehicle) {
    Schedule schedule = vehicle.getSchedule();

    if (schedule.getStatus() != Schedule.ScheduleStatus.STARTED) {
        // I) Before the schedule, we need to prepare the first stay task.
        prepareFirstTask(vehicle, schedule);
    } else {
        // II) Advance schedule in running simulation
        advanceSchedule(vehicle, schedule);
    }
}
 
Example #28
Source File: SingleHeuristicDispatcher.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
private void removeVehicle(DvrpVehicle vehicle) {
    if (!availableVehicles.contains(vehicle)) {
        throw new IllegalStateException();
    }

    availableVehicles.remove(vehicle);
    Coord coord = vehicleLinks.remove(vehicle).getCoord();
    availableVehiclesTree.remove(coord.getX(), coord.getY(), vehicle);
}
 
Example #29
Source File: SingleHeuristicDispatcher.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
private DvrpVehicle findVehicle() {
    return availableVehicles.get(0);
}
 
Example #30
Source File: SingleHeuristicDispatcher.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
private DvrpVehicle findClosestVehicle(Link link) {
    Coord coord = link.getCoord();
    return availableVehiclesTree.getClosest(coord.getX(), coord.getY());
}