 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
35 std::ostringstream oss;
63 double sigmoidValue = 1.0 / (1.0 + exp(-
m_k * (elapsed / 1000 - stage->
duration / 1000)));
66 std::ostringstream oss;
67 oss <<
m_prefix <<
"::sigmoidLogic [k=" <<
m_k <<
" elapsed " << elapsed <<
" stage->duration " << stage->
duration <<
" ] value "
69 oss <<
" rnd " << rnd <<
" retval " << (rnd < sigmoidValue ?
"true" :
"false");
72 return rnd < sigmoidValue;
79 const std::map<std::string, std::string>& parameters) :
87 desirabilityAlgorithm) {
93 const std::map<std::string, std::string>& parameters) :
94 Parameterised(parameters), myName(name), myDesirabilityAlgorithm(
95 desirabilityAlgorithm) {
105 std::ostringstream str; str <<
"\nMSSOTLPolicy::computeStimulus\n" <<
getName();
WRITE_MESSAGE(str.str());)
114 std::ostringstream str; str <<
"\nMSSOTLPolicy::computeStimulus\n" <<
getName();
WRITE_MESSAGE(str.str());)
122 int phaseMaxCTS,
bool thresholdPassed,
bool pushButtonPressed,
int vehicleCount) {
134 return currentPhaseIndex + 1;
139 std::ostringstream phero_str;
140 phero_str <<
"getCurrentPhaseElapsed()=" <<
time2string(elapsed) <<
" isThresholdPassed()=" << thresholdPassed <<
" countVehicles()=" << vehicleCount;
141 WRITE_MESSAGE(
"MSSOTLPolicy::decideNextPhase: " + phero_str.str());
143 if (
canRelease(elapsed, thresholdPassed, pushButtonPressed, stage, vehicleCount)) {
144 return currentPhaseIndex + 1;
148 return currentPhaseIndex;
virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition *stage, int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount)
An upper class for objects with additional parameters.
void init(std::string prefix, const Parameterised *parameterised)
bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition *stage, int vehicleCount)
double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure)
Computes the desirability of this policy, necessary when used in combination with an high level polic...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
MSSOTLPolicy(std::string name, const std::map< std::string, std::string > ¶meters)
Simple constructor.
virtual double computeDesirability(double vehInMeasure, double vehOutMeasure)=0
Calculates the desirability of the policy.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
bool isDecisional() const
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
SUMOTime duration
The duration of the phase.
double theta_sensitivity
The sensitivity of this policy.
std::string time2string(SUMOTime t)
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
The definition of a single phase of a tls logic.
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
#define WRITE_MESSAGE(msg)
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.\nIt's an optional component related to the computeDesira...