SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSSOTLPolicy.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The class for low-level policy
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 #ifndef MSTLPolicy_h
25 #define MSTLPolicy_h
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 //#define SWARM_DEBUG
38 #include <sstream>
39 #include <math.h>
40 #include <utility>
41 #include <vector>
43 #include "MSPhaseDefinition.h"
45 
47 protected:
48  void init(std::string prefix, const Parameterised* parameterised);
49 
50  bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition* stage);
51 
53  std::string m_prefix;
54 };
55 
56 class SigmoidLogic {
57 protected:
58  void init(std::string prefix, const Parameterised* parameterised);
59 
60  bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount);
61 
64  std::string m_prefix;
65 };
66 
72 class MSSOTLPolicy: public Parameterised {
73 private:
74 
82  std::string myName;
88 
89 protected:
90  virtual void init() {}
91 
92 public:
97  MSSOTLPolicy(std::string name,
98  const std::map<std::string, std::string>& parameters);
103  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm);
109  MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm,
110  const std::map<std::string, std::string>& parameters);
111  virtual ~MSSOTLPolicy();
112 
113  virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed,
114  const MSPhaseDefinition* stage, int vehicleCount) = 0;
115  virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition* stage,
116  int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed,
117  int vehicleCount);
118 
120  return theta_sensitivity;
121  }
122  virtual void setThetaSensitivity(SUMOReal val) {
123  theta_sensitivity = val;
124  }
125  std::string getName() {
126  return myName;
127  }
130  }
134  SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure);
135 
136  SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure);
137 };
138 
139 #endif
long long int SUMOTime
Definition: SUMOTime.h:43
std::string m_prefix
Definition: MSSOTLPolicy.h:64
SUMOReal m_k
Definition: MSSOTLPolicy.h:63
void init(std::string prefix, const Parameterised *parameterised)
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition *stage, int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount)
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
virtual void init()
Definition: MSSOTLPolicy.h:90
bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition *stage, int vehicleCount)
virtual void setThetaSensitivity(SUMOReal val)
Definition: MSSOTLPolicy.h:122
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
Definition: MSSOTLPolicy.h:128
SUMOReal m_pushButtonScaleFactor
Definition: MSSOTLPolicy.h:52
SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure)
Computes the desirability of this policy, necessary when used in combination with an high level polic...
MSSOTLPolicy(std::string name, const std::map< std::string, std::string > &parameters)
Simple constructor.
bool m_useSigmoid
Definition: MSSOTLPolicy.h:62
SUMOReal theta_sensitivity
The sensitivity of this policy.
Definition: MSSOTLPolicy.h:78
std::string getName()
Definition: MSSOTLPolicy.h:125
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
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 ~MSSOTLPolicy()
Class for a low-level policy.
Definition: MSSOTLPolicy.h:72
#define SUMOReal
Definition: config.h:214
virtual SUMOReal getThetaSensitivity()
Definition: MSSOTLPolicy.h:119
std::string myName
The name of the policy.
Definition: MSSOTLPolicy.h:82
The definition of a single phase of a tls logic.
std::string m_prefix
Definition: MSSOTLPolicy.h:53
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.'s an optional component related to the computeDesirabili...
Definition: MSSOTLPolicy.h:87