Eclipse SUMO - Simulation of Urban MObility
MSDispatch_Greedy.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2007-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // An algorithm that performs dispatch for the taxi device
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <set>
24 #include <vector>
25 #include <map>
27 #include <utils/common/SUMOTime.h>
28 #include "MSDispatch.h"
29 #include "MSDevice_Taxi.h"
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 
40 class MSDispatch_Greedy : public MSDispatch {
41 public:
43  MSDispatch(params),
44  myRoutingMode(StringUtils::toInt(getParameter("routingMode", "1"))),
45  myMaximumWaitingTime(TIME2STEPS(StringUtils::toInt(getParameter("maxWaitingTime", "300")))),
46  myRecheckTime(TIME2STEPS(StringUtils::toInt(getParameter("recheckTime", "120")))),
47  myRecheckSafety(TIME2STEPS(StringUtils::toInt(getParameter("recheckSafety", "3600"))))
48  { }
49 
50  virtual void computeDispatch(SUMOTime now, const std::vector<MSDevice_Taxi*>& fleet);
51 
52 protected:
54  virtual int dispatch(MSDevice_Taxi* taxi, std::vector<Reservation*>::iterator& resIt, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, std::vector<Reservation*>& reservations);
55 
57  const int myRoutingMode;
58 
61 
65 
66 private:
69 
70 };
71 
72 
78 public:
80  MSDispatch_Greedy(params)
81  {}
82 
83  void computeDispatch(SUMOTime now, const std::vector<MSDevice_Taxi*>& fleet);
84 
85 };
long long int SUMOTime
Definition: GUI.h:35
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Taxi.h:49
A dispatch algorithm that services the reservations with the shortest traveltime-to-pickup first.
MSDispatch_GreedyClosest(const Parameterised::Map &params)
void computeDispatch(SUMOTime now, const std::vector< MSDevice_Taxi * > &fleet)
computes dispatch and updates reservations
A dispatch algorithm that services customers in reservation order and always sends the closest availa...
const SUMOTime myRecheckTime
recheck interval for early reservations
virtual void computeDispatch(SUMOTime now, const std::vector< MSDevice_Taxi * > &fleet)
computes dispatch and updates reservations
MSDispatch_Greedy & operator=(const MSDispatch_Greedy &)=delete
Invalidated assignment operator.
const int myRoutingMode
which router/edge weights to use
virtual int dispatch(MSDevice_Taxi *taxi, std::vector< Reservation * >::iterator &resIt, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, std::vector< Reservation * > &reservations)
trigger taxi dispatch.
const SUMOTime myRecheckSafety
const SUMOTime myMaximumWaitingTime
maximum time to arrive earlier at customer
MSDispatch_Greedy(const Parameterised::Map &params)
An algorithm that performs distpach for a taxi fleet.
Definition: MSDispatch.h:112
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
Some static methods for string processing.
Definition: StringUtils.h:40