|
|
@ -116,22 +116,20 @@ int main(int argc, char* argv[]) { |
|
|
|
parsingStateRewards = true; |
|
|
|
parsingBackground = false; |
|
|
|
continue; |
|
|
|
} else if (line.at(0) == '-' && line.at(line.size() - 1 ) == '-' && parsingStateRewards) { |
|
|
|
parsingStateRewards = false; |
|
|
|
parsingEnvironmentProperties = true; |
|
|
|
continue; |
|
|
|
} else if(line.at(0) == '-' && line.at(line.size() - 1) == '-') { |
|
|
|
parsingBackground = true; |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(!parsingBackground && !parsingStateRewards) { |
|
|
|
// std::cout << "Reading :\t" << line << "\n";
|
|
|
|
if(!parsingBackground && !parsingStateRewards && !parsingEnvironmentProperties) { |
|
|
|
content += line + "\n"; |
|
|
|
} else if (parsingBackground) { |
|
|
|
// std::cout << "Background:\t" << line << "\n";
|
|
|
|
background += line + "\n"; |
|
|
|
} else if(parsingStateRewards) { |
|
|
|
rewards += line + "\n"; |
|
|
|
} else if (line.at(0) == '-' && line.at(line.size() - 1 ) == '-' && parsingStateRewards) { |
|
|
|
parsingStateRewards = false; |
|
|
|
parsingEnvironmentProperties = true; |
|
|
|
continue; |
|
|
|
} else if (parsingEnvironmentProperties) { |
|
|
|
properties += line + "\n"; |
|
|
|
} |
|
|
@ -151,6 +149,8 @@ int main(int argc, char* argv[]) { |
|
|
|
cells backgroundCells; |
|
|
|
std::vector<Configuration> configurations; |
|
|
|
std::map<coordinates, float> stateRewards; |
|
|
|
double faultyProbability; |
|
|
|
|
|
|
|
try { |
|
|
|
bool ok = phrase_parse(contentIter, contentLast, contentParser, qi::space, contentCells); |
|
|
|
// TODO if(background is not empty) {
|
|
|
@ -169,8 +169,20 @@ int main(int argc, char* argv[]) { |
|
|
|
float reward = std::stof(*(++iter)); |
|
|
|
stateRewards[std::make_pair(x,y)] = reward; |
|
|
|
} |
|
|
|
if (!properties.empty()) { |
|
|
|
auto faultProbabilityIdentifier = std::string("FaultProbability:"); |
|
|
|
auto start_pos = properties.find(faultProbabilityIdentifier); |
|
|
|
|
|
|
|
|
|
|
|
if (start_pos != std::string::npos) { |
|
|
|
auto end_pos = properties.find('\n', start_pos); |
|
|
|
auto value = properties.substr(start_pos + faultProbabilityIdentifier.length(), end_pos - start_pos - faultProbabilityIdentifier.length()); |
|
|
|
faultyProbability = std::stod(value); |
|
|
|
std::cout << "Probabilty" << faultyProbability << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
if(ok) { |
|
|
|
Grid grid(contentCells, backgroundCells, gridOptions, stateRewards); |
|
|
|
Grid grid(contentCells, backgroundCells, gridOptions, stateRewards, faultyProbability); |
|
|
|
//grid.printToPrism(std::cout, prism::ModelType::MDP);
|
|
|
|
std::stringstream ss; |
|
|
|
// grid.printToPrism(file, configurations ,prism::ModelType::MDP);
|
|
|
|