SUMO - Simulation of Urban MObility
MSSOTLPolicy.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2013-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // The class for low-level policy
21 /****************************************************************************/
22 
23 #ifndef MSTLPolicy_h
24 #define MSTLPolicy_h
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 //#define SWARM_DEBUG
37 #include <sstream>
38 #include <cmath>
39 #include <utility>
40 #include <vector>
42 #include "MSPhaseDefinition.h"
44 
46 protected:
47  void init(std::string prefix, const Parameterised* parameterised);
48 
49  bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition* stage);
50 
52  std::string m_prefix;
53 };
54 
55 class SigmoidLogic {
56 protected:
57  void init(std::string prefix, const Parameterised* parameterised);
58 
59  bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount);
60 
62  double m_k;
63  std::string m_prefix;
64 };
65 
71 class MSSOTLPolicy: public Parameterised {
72 private:
73 
81  std::string myName;
87 
88 protected:
89  virtual void init() {}
90 
91 public:
96  MSSOTLPolicy(std::string name,
97  const std::map<std::string, std::string>& parameters);
102  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm);
108  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm,
109  const std::map<std::string, std::string>& parameters);
110  virtual ~MSSOTLPolicy();
111 
112  virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed,
113  const MSPhaseDefinition* stage, int vehicleCount) = 0;
114  virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition* stage,
115  int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed,
116  int vehicleCount);
117 
118  virtual double getThetaSensitivity() {
119  return theta_sensitivity;
120  }
121  virtual void setThetaSensitivity(double val) {
122  theta_sensitivity = val;
123  }
124  std::string getName() {
125  return myName;
126  }
128  return myDesirabilityAlgorithm;
129  }
133  double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure);
134 
135  double computeDesirability(double vehInMeasure, double vehOutMeasure);
136 };
137 
138 #endif
std::string m_prefix
Definition: MSSOTLPolicy.h:63
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
double theta_sensitivity
The sensitivity of this policy.
Definition: MSSOTLPolicy.h:77
virtual void init()
Definition: MSSOTLPolicy.h:89
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
Definition: MSSOTLPolicy.h:127
bool m_useSigmoid
Definition: MSSOTLPolicy.h:61
std::string getName()
Definition: MSSOTLPolicy.h:124
An upper class for objects with additional parameters.
Definition: Parameterised.h:50
virtual void setThetaSensitivity(double val)
Definition: MSSOTLPolicy.h:121
void init(std::string prefix, const Parameterised *parameterised)
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
virtual double getThetaSensitivity()
Definition: MSSOTLPolicy.h:118
double m_pushButtonScaleFactor
Definition: MSSOTLPolicy.h:51
Class for a low-level policy.
Definition: MSSOTLPolicy.h:71
long long int SUMOTime
Definition: TraCIDefs.h:51
std::string myName
The name of the policy.
Definition: MSSOTLPolicy.h:81
The definition of a single phase of a tls logic.
std::string m_prefix
Definition: MSSOTLPolicy.h:52
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.&#39;s an optional component related to the computeDesirabili...
Definition: MSSOTLPolicy.h:86