33 const std::map<std::string, std::string>& parameters) :
65 int size_family = int(
getDouble(keyPrefix +
"_SIZE_FAMILY", 1));
68 std::ostringstream str;
69 str << keyPrefix <<
"\n" <<
"size fam" << size_family;
73 std::vector< std::map <std::string, std::string > > sliced_maps;
75 for (
int i = 0; i < size_family; i++) {
76 sliced_maps.push_back(std::map<std::string, std::string>());
85 for (
int token_counter = 0; token_counter < size_family; ++token_counter) {
86 if (token_counter >= (
int)tokens.size()) {
87 std::ostringstream errorMessage;
88 errorMessage <<
"Error in " << key <<
": not enough tokens.";
93 std::ostringstream str;
94 str <<
"found token " << tokens[token_counter] <<
" position " << token_counter;
97 sliced_maps[token_counter][key] = tokens[token_counter];
101 for (
int i = 0; i < size_family; i++) {
102 std::map<std::string, std::string>& ref_map = sliced_maps[i];
118 double best_stimulus = -1;
119 for (std::vector<MSSOTLPolicy5DStimulus*>::const_iterator it =
family.begin(); it !=
family.end(); it++) {
120 double temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure);
122 std::ostringstream str;
123 str <<
"STIMULUS: " << temp_stimulus;
126 if (temp_stimulus > best_stimulus) {
127 best_stimulus = temp_stimulus;
132 std::ostringstream str;
133 str <<
"BEST STIMULUS: " << best_stimulus;
136 return best_stimulus;
146 std::ostringstream ot;
147 for (
int i = 0; i < (int)
family.size(); i++) {
148 ot <<
" gaussian " << i <<
":" <<
family[i]->getMessage();
MSSOTLPolicy5DFamilyStimulus(std::string keyPrefix, const std::map< std::string, std::string > ¶meters)
std::map< std::string, std::string > default_values
virtual double computeDesirability(double vehInMeasure, double vehOutMeasure)
Calculates the desirability of the policy.
std::vector< MSSOTLPolicy5DStimulus * > family
std::vector< std::string > getVector()
return vector of strings
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
std::vector< std::string > params_names
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
#define WRITE_MESSAGE(msg)