Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The class for low-level policy
19 /****************************************************************************/
20 
21 #ifndef MSTLPolicy_h
22 #define MSTLPolicy_h
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 //#define SWARM_DEBUG
31 #include <sstream>
32 #include <cmath>
33 #include <utility>
34 #include <vector>
36 #include "MSPhaseDefinition.h"
38 
40 protected:
41  void init(std::string prefix, const Parameterised* parameterised);
42 
43  bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition* stage);
44 
46  std::string m_prefix;
47 };
48 
49 class SigmoidLogic {
50 protected:
51  void init(std::string prefix, const Parameterised* parameterised);
52 
53  bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount);
54 
56  double m_k;
57  std::string m_prefix;
58 };
59 
65 class MSSOTLPolicy: public Parameterised {
66 private:
67 
75  std::string myName;
81 
82 protected:
83  virtual void init() {}
84 
85 public:
90  MSSOTLPolicy(std::string name,
91  const std::map<std::string, std::string>& parameters);
96  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm);
102  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm,
103  const std::map<std::string, std::string>& parameters);
104  virtual ~MSSOTLPolicy();
105 
106  virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed,
107  const MSPhaseDefinition* stage, int vehicleCount) = 0;
108  virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition* stage,
109  int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed,
110  int vehicleCount);
111 
112  virtual double getThetaSensitivity() {
113  return theta_sensitivity;
114  }
115  virtual void setThetaSensitivity(double val) {
116  theta_sensitivity = val;
117  }
118  std::string getName() {
119  return myName;
120  }
122  return myDesirabilityAlgorithm;
123  }
127  double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure);
128 
129  double computeDesirability(double vehInMeasure, double vehOutMeasure);
130 };
131 
132 #endif
long long int SUMOTime
Definition: SUMOTime.h:35
std::string m_prefix
Definition: MSSOTLPolicy.h:57
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
double theta_sensitivity
The sensitivity of this policy.
Definition: MSSOTLPolicy.h:71
virtual void init()
Definition: MSSOTLPolicy.h:83
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
Definition: MSSOTLPolicy.h:121
bool m_useSigmoid
Definition: MSSOTLPolicy.h:55
std::string getName()
Definition: MSSOTLPolicy.h:118
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
virtual void setThetaSensitivity(double val)
Definition: MSSOTLPolicy.h:115
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:112
double m_pushButtonScaleFactor
Definition: MSSOTLPolicy.h:45
Class for a low-level policy.
Definition: MSSOTLPolicy.h:65
std::string myName
The name of the policy.
Definition: MSSOTLPolicy.h:75
The definition of a single phase of a tls logic.
std::string m_prefix
Definition: MSSOTLPolicy.h:46
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.&#39;s an optional component related to the computeDesirabili...
Definition: MSSOTLPolicy.h:80