001/* *********************************************************************** *
002 * project: org.matsim.*
003 *                                                                         *
004 * *********************************************************************** *
005 *                                                                         *
006 * copyright       : (C) 2017 by the members listed in the COPYING,        *
007 *                   LICENSE and WARRANTY file.                            *
008 * email           : info at matsim dot org                                *
009 *                                                                         *
010 * *********************************************************************** *
011 *                                                                         *
012 *   This program is free software; you can redistribute it and/or modify  *
013 *   it under the terms of the GNU General Public License as published by  *
014 *   the Free Software Foundation; either version 2 of the License, or     *
015 *   (at your option) any later version.                                   *
016 *   See also COPYING, LICENSE and WARRANTY file                           *
017 *                                                                         *
018 * *********************************************************************** */
019
020package org.matsim.contrib.drt.optimizer.rebalancing;
021
022import java.util.List;
023import java.util.stream.Stream;
024
025import org.matsim.api.core.v01.network.Link;
026import org.matsim.contrib.dvrp.fleet.DvrpVehicle;
027
028/**
029 * Idle vehicles (=StayTask) may be re-allocated using this interface.
030 * 
031 * @author michalm
032 */
033public interface RebalancingStrategy {
034        public class Relocation {
035                public final DvrpVehicle vehicle;
036                public final Link link;
037
038                public Relocation(DvrpVehicle vehicle, Link link) {
039                        this.vehicle = vehicle;
040                        this.link = link;
041                }
042        }
043
044        /**
045         * This method is called at each re-balancing step (interval defined in config).
046         * 
047         */
048        List<Relocation> calcRelocations(Stream<? extends DvrpVehicle> rebalancableVehicles, double time);
049}