Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSSOTLPolicy.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2013-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// The class for low-level policy
22/****************************************************************************/
23
24#pragma once
25#include <config.h>
26
27#include <sstream>
28#include <cmath>
29#include <utility>
30#include <vector>
32#include "MSPhaseDefinition.h"
34
36protected:
37 void init(std::string prefix, const Parameterised* parameterised);
38
39 bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition* stage);
40
42 std::string m_prefix;
43};
44
46protected:
47 void init(std::string prefix, const Parameterised* parameterised);
48
49 bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount);
50
52 double m_k;
53 std::string m_prefix;
54};
55
62private:
63
71 std::string myName;
77
78protected:
79 virtual void init() {}
80
81public:
86 MSSOTLPolicy(std::string name,
87 const Parameterised::Map& parameters);
92 MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm);
98 MSSOTLPolicy(std::string name, MSSOTLPolicyDesirability* desirabilityAlgorithm,
99 const Parameterised::Map& parameters);
100 virtual ~MSSOTLPolicy();
101
102 virtual bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed,
103 const MSPhaseDefinition* stage, int vehicleCount) = 0;
104 virtual int decideNextPhase(SUMOTime elapsed, const MSPhaseDefinition* stage,
105 int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed,
106 int vehicleCount);
107
108 virtual double getThetaSensitivity() {
109 return theta_sensitivity;
110 }
111 virtual void setThetaSensitivity(double val) {
112 theta_sensitivity = val;
113 }
114 std::string getName() {
115 return myName;
116 }
123 double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure);
124
125 double computeDesirability(double vehInMeasure, double vehOutMeasure);
126};
long long int SUMOTime
Definition GUI.h:36
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...
Class for a low-level policy.
std::string myName
The name of the policy.
MSSOTLPolicyDesirability * myDesirabilityAlgorithm
A pointer to the policy desirability object.\nIt's an optional component related to the computeDesira...
virtual void setThetaSensitivity(double val)
virtual ~MSSOTLPolicy()
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)
virtual double getThetaSensitivity()
virtual void init()
std::string getName()
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
std::string m_prefix
double m_pushButtonScaleFactor
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
void init(std::string prefix, const Parameterised *parameterised)
void init(std::string prefix, const Parameterised *parameterised)
std::string m_prefix
bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition *stage, int vehicleCount)