40 const std::map<std::string, std::string>& parameters) :
72 int size_family = int(
readParameter(keyPrefix +
"_SIZE_FAMILY", 1));
75 std::ostringstream str;
76 str << keyPrefix <<
"\n" <<
"size fam" << size_family;
80 std::vector< std::map <std::string, std::string > > sliced_maps;
82 for (
int i = 0; i < size_family; i++) {
83 sliced_maps.push_back(std::map<std::string, std::string>());
92 for (
int token_counter = 0; token_counter < size_family; ++token_counter) {
93 if (token_counter >= (
int)tokens.size()) {
94 std::ostringstream errorMessage;
95 errorMessage <<
"Error in " << key <<
": not enough tokens.";
100 std::ostringstream str;
101 str <<
"found token " << tokens[token_counter] <<
" position " << token_counter;
104 sliced_maps[token_counter][key] = tokens[token_counter];
108 for (
int i = 0; i < size_family; i++) {
109 std::map<std::string, std::string>& ref_map = sliced_maps[i];
125 double best_stimulus = -1;
126 for (std::vector<MSSOTLPolicy5DStimulus*>::const_iterator it =
family.begin(); it !=
family.end(); it++) {
127 double temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure);
129 std::ostringstream str;
130 str <<
"STIMULUS: " << temp_stimulus;
133 if (temp_stimulus > best_stimulus) {
134 best_stimulus = temp_stimulus;
139 std::ostringstream str;
140 str <<
"BEST STIMULUS: " << best_stimulus;
143 return best_stimulus;
153 std::ostringstream ot;
154 for (
int i = 0; i < (int)
family.size(); i++) {
155 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()
This class determines the desirability algorithm of a MSSOTLPolicy when used in combination with a hi...
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
std::vector< std::string > params_names
#define WRITE_MESSAGE(msg)
double readParameter(std::string parName, double defValue)