SUMO - Simulation of Urban MObility
MSSOTLMarchingPolicy.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // The class for SOTL Marching logics
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 #include "MSSOTLMarchingPolicy.h"
24 
26  const std::map<std::string, std::string>& parameters) :
27  MSSOTLPolicy("Marching", parameters) {
28  init();
29 }
30 
32  MSSOTLPolicyDesirability* desirabilityAlgorithm) :
33  MSSOTLPolicy("Marching", desirabilityAlgorithm) {
35  init();
36 }
37 
39  MSSOTLPolicyDesirability* desirabilityAlgorithm,
40  const std::map<std::string, std::string>& parameters) :
41  MSSOTLPolicy("Marching", desirabilityAlgorithm, parameters) {
43  init();
44 }
45 
46 bool MSSOTLMarchingPolicy::canRelease(SUMOTime elapsed, bool /* thresholdPassed */, bool pushButtonPressed,
47  const MSPhaseDefinition* stage, int /* vehicleCount */) {
48  if (elapsed >= stage->minDuration && pushButtonLogic(elapsed, pushButtonPressed, stage)) {
49  return true;
50  }
51  return (elapsed >= stage->duration);
52 }
53 
55  PushButtonLogic::init("MSSOTLMarchingPolicy", this);
56 }
long long int SUMOTime
Definition: SUMOTime.h:43
bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition *stage)
MSSOTLPolicyDesirability * getDesirabilityAlgorithm()
Definition: MSSOTLPolicy.h:128
SUMOTime duration
The duration of the phase.
void setKeyPrefix(std::string val)
void init(std::string prefix, const Parameterised *parameterised)
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
MSSOTLMarchingPolicy(const std::map< std::string, std::string > &parameters)
Class for a low-level policy.
Definition: MSSOTLPolicy.h:72
SUMOTime minDuration
The minimum duration of the phase.
The definition of a single phase of a tls logic.
bool canRelease(SUMOTime elapsed, bool thresholdPassed, bool pushButtonPressed, const MSPhaseDefinition *stage, int vehicleCount)