44 std::ostringstream oss;
75 std::ostringstream oss;
76 oss <<
m_prefix <<
"::sigmoidLogic [k=" <<
m_k <<
" elapsed " << elapsed <<
" stage->duration " << stage->
duration <<
" ] value "
78 oss <<
" rnd " << rnd <<
" retval " << (rnd < sigmoidValue ?
"true" :
"false");
81 return rnd < sigmoidValue;
96 desirabilityAlgorithm) {
103 Parameterised(parameters), myName(name), myDesirabilityAlgorithm(
104 desirabilityAlgorithm) {
113 std::ostringstream str;
114 str <<
"\nMSSOTLPolicy::computeStimulus\n" <<
getName();
122 std::ostringstream str;
123 str <<
"\nMSSOTLPolicy::computeStimulus\n" <<
getName();
131 int phaseMaxCTS,
bool thresholdPassed,
bool pushButtonPressed,
int vehicleCount) {
143 return currentPhaseIndex + 1;
148 std::ostringstream phero_str;
149 phero_str <<
"getCurrentPhaseElapsed()=" <<
time2string(elapsed) <<
" isThresholdPassed()=" << thresholdPassed <<
" countVehicles()=" << vehicleCount;
150 WRITE_MESSAGE(
"MSSOTLPolicy::decideNextPhase: " + phero_str.str());
152 if (
canRelease(elapsed, thresholdPassed, pushButtonPressed, stage, vehicleCount)) {
153 return currentPhaseIndex + 1;
157 return currentPhaseIndex;
#define WRITE_MESSAGE(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
The definition of a single phase of a tls logic.
SUMOTime duration
The duration of the phase.
bool isDecisional() const
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
virtual double computeDesirability(double vehInMeasure, double vehOutMeasure)=0
Calculates the desirability of the policy.
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.\nIt's an optional component related to the computeDesira...
MSSOTLPolicy(std::string name, const Parameterised::Map ¶meters)
Simple constructor.
double theta_sensitivity
The sensitivity of this policy.
virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)=0
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...
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.
std::map< std::string, std::string > Map
parameters map
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
void init(std::string prefix, const Parameterised *parameterised)
bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition *stage, int vehicleCount)
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter