35 #ifdef CHECK_MEMORY_LEAKS 37 #endif // CHECK_MEMORY_LEAKS 44 const std::map<std::string, std::string>& parameters) :
76 int size_family = int(
readParameter(keyPrefix +
"_SIZE_FAMILY", 1));
79 std::ostringstream str;
80 str << keyPrefix <<
"\n" <<
"size fam" << size_family;
84 std::vector< std::map <std::string, std::string > > sliced_maps;
86 for (
int i = 0; i < size_family; i++) {
87 sliced_maps.push_back(std::map<std::string, std::string>());
96 for (
int token_counter = 0; token_counter < size_family; ++token_counter) {
97 if (token_counter >= (
int)tokens.size()) {
98 std::ostringstream errorMessage;
99 errorMessage <<
"Error in " << key <<
": not enough tokens.";
104 std::ostringstream str;
105 str <<
"found token " << tokens[token_counter] <<
" position " << token_counter;
108 sliced_maps[token_counter][key] = tokens[token_counter];
112 for (
int i = 0; i < size_family; i++) {
113 std::map<std::string, std::string>& ref_map = sliced_maps[i];
130 for (std::vector<MSSOTLPolicy5DStimulus*>::const_iterator it =
family.begin(); it !=
family.end(); it++) {
131 SUMOReal temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure);
133 std::ostringstream str;
134 str <<
"STIMULUS: " << temp_stimulus;
137 if (temp_stimulus > best_stimulus) {
138 best_stimulus = temp_stimulus;
143 std::ostringstream str;
144 str <<
"BEST STIMULUS: " << best_stimulus;
147 return best_stimulus;
157 std::ostringstream ot;
158 for (
int i = 0; i < (int)
family.size(); i++) {
159 ot <<
" gaussian " << i <<
":" <<
family[i]->getMessage();
virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure)
Calculates the desirability of the policy.
MSSOTLPolicy5DFamilyStimulus(std::string keyPrefix, const std::map< std::string, std::string > ¶meters)
std::map< std::string, std::string > default_values
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
std::vector< MSSOTLPolicy5DStimulus * > family
SUMOReal readParameter(std::string parName, SUMOReal defValue)
std::vector< std::string > getVector()
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
std::vector< std::string > params_names
#define WRITE_MESSAGE(msg)