39 const std::map<std::string, std::string>& parameters) :
71 int size_family = int(
readParameter(keyPrefix +
"_SIZE_FAMILY", 1));
74 std::ostringstream str;
75 str << keyPrefix <<
"\n" <<
"size fam" << size_family;
79 std::vector< std::map <std::string, std::string > > sliced_maps;
81 for (
int i = 0; i < size_family; i++) {
82 sliced_maps.push_back(std::map<std::string, std::string>());
91 for (
int token_counter = 0; token_counter < size_family; ++token_counter) {
92 if (token_counter >= (
int)tokens.size()) {
93 std::ostringstream errorMessage;
94 errorMessage <<
"Error in " << key <<
": not enough tokens.";
99 std::ostringstream str;
100 str <<
"found token " << tokens[token_counter] <<
" position " << token_counter;
103 sliced_maps[token_counter][key] = tokens[token_counter];
107 for (
int i = 0; i < size_family; i++) {
108 std::map<std::string, std::string>& ref_map = sliced_maps[i];
124 double best_stimulus = -1;
125 for (std::vector<MSSOTLPolicy5DStimulus*>::const_iterator it =
family.begin(); it !=
family.end(); it++) {
126 double temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure);
128 std::ostringstream str;
129 str <<
"STIMULUS: " << temp_stimulus;
132 if (temp_stimulus > best_stimulus) {
133 best_stimulus = temp_stimulus;
138 std::ostringstream str;
139 str <<
"BEST STIMULUS: " << best_stimulus;
142 return best_stimulus;
152 std::ostringstream ot;
153 for (
int i = 0; i < (int)
family.size(); i++) {
154 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...
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)
double readParameter(std::string parName, double defValue)