25 const std::map<std::string, std::string>& parameters) :
57 int size_family = int(
readParameter(keyPrefix +
"_SIZE_FAMILY", 1));
60 std::ostringstream str;
61 str << keyPrefix <<
"\n" <<
"size fam" << size_family;
65 std::vector< std::map <std::string, std::string > > sliced_maps;
67 for (
int i = 0; i < size_family; i++) {
68 sliced_maps.push_back(std::map<std::string, std::string>());
76 char* dup = strdup(param_list.c_str());
80 for (token_counter = 0, pch = strtok(dup,
";"); token_counter < size_family; ++token_counter, pch = strtok(NULL,
";")) {
82 std::ostringstream errorMessage;
83 errorMessage <<
"Error in " << key <<
": not enough tokens.";
87 std::string token_found(pch);
89 std::ostringstream str;
90 str <<
"found token " << token_found <<
" position " << token_counter;
93 (sliced_maps[token_counter])[key] = token_found;
98 for (
int i = 0; i < size_family; i++) {
99 std::map<std::string, std::string>& ref_map = sliced_maps[i];
116 for (std::vector<MSSOTLPolicy5DStimulus*>::const_iterator it =
family.begin(); it !=
family.end(); it++) {
117 SUMOReal temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure);
119 std::ostringstream str;
120 str <<
"STIMULUS: " << temp_stimulus;
123 if (temp_stimulus > best_stimulus) {
124 best_stimulus = temp_stimulus;
129 std::ostringstream str;
130 str <<
"BEST STIMULUS: " << best_stimulus;
133 return best_stimulus;
143 std::ostringstream ot;
144 for (
int i = 0; i < (int)
family.size(); i++) {
145 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)
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)