From aa6fd9219e5b71545d535115ebe1875ede6e6fe4 Mon Sep 17 00:00:00 2001 From: sp Date: Sat, 13 Jan 2024 18:24:55 +0100 Subject: [PATCH] removed GridOptions --- main.cpp | 8 +++----- util/Grid.cpp | 16 +++------------- util/Grid.h | 15 +++------------ 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/main.cpp b/main.cpp index 7b70a81..16a752d 100644 --- a/main.cpp +++ b/main.cpp @@ -83,7 +83,6 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - GridOptions gridOptions = { {}, {} }; std::fstream file {outputFilename->value(0), file.trunc | file.out}; std::fstream infile {inputFilename->value(0), infile.in}; std::string line, content, background, rewards, properties; @@ -164,12 +163,11 @@ int main(int argc, char* argv[]) { setProbability(properties, probabilities, probTurnIntendedIdentifier, probTurnIntended); } if(ok) { - Grid grid(contentCells, backgroundCells, gridOptions, stateRewards, probIntended, faultyProbability); + Grid grid(contentCells, backgroundCells, stateRewards, probIntended, faultyProbability); - // grid.printToPrism(std::cout, configurations , gridOptions.getModelType()); + grid.printToPrism(std::cout, configurations); std::stringstream ss; - // grid.printToPrism(file, configurations ,prism::ModelType::MDP); - grid.printToPrism(ss, configurations , gridOptions.getModelType()); + grid.printToPrism(ss, configurations); std::string str = ss.str(); grid.applyOverwrites(str, configurations); file << str; diff --git a/util/Grid.cpp b/util/Grid.cpp index f9ebdac..d5e454e 100644 --- a/util/Grid.cpp +++ b/util/Grid.cpp @@ -3,16 +3,8 @@ #include -prism::ModelType GridOptions::getModelType() const -{ - if (agentsWithView.size() > 1) { - return prism::ModelType::SMG; - } - return prism::ModelType::MDP; -} - -Grid::Grid(cells gridCells, cells background, const GridOptions &gridOptions, const std::map &stateRewards, const float probIntended, const float faultyProbability) - : allGridCells(gridCells), background(background), gridOptions(gridOptions), stateRewards(stateRewards), probIntended(probIntended), faultyProbability(faultyProbability) +Grid::Grid(cells gridCells, cells background, const std::map &stateRewards, const float probIntended, const float faultyProbability) + : allGridCells(gridCells), background(background), stateRewards(stateRewards), probIntended(probIntended), faultyProbability(faultyProbability) { cell max = allGridCells.at(allGridCells.size() - 1); maxBoundaries = std::make_pair(max.row - 1, max.column - 1); @@ -38,7 +30,6 @@ Grid::Grid(cells gridCells, cells background, const GridOptions &gridOptions, co std::string color = adversary.getColor(); color.at(0) = std::toupper(color.at(0)); try { - if(gridOptions.agentsToBeConsidered.size() != 0 && std::find(gridOptions.agentsToBeConsidered.begin(), gridOptions.agentsToBeConsidered.end(), color) == gridOptions.agentsToBeConsidered.end()) continue; auto success = agentNameAndPositionMap.insert({ color, adversary.getCoordinates() }); floor.push_back(adversary); if(!success.second) { @@ -130,9 +121,8 @@ void Grid::applyOverwrites(std::string& str, std::vector& configu } } } -void Grid::printToPrism(std::ostream& os, std::vector& configuration ,const prism::ModelType& modelType) { +void Grid::printToPrism(std::ostream& os, std::vector& configuration) { cells northRestriction, eastRestriction, southRestriction, westRestriction; - cells walkable = floor; walkable.insert(walkable.end(), goals.begin(), goals.end()); walkable.insert(walkable.end(), boxes.begin(), boxes.end()); diff --git a/util/Grid.h b/util/Grid.h index eb95437..7e890d3 100644 --- a/util/Grid.h +++ b/util/Grid.h @@ -6,29 +6,20 @@ #include #include "MinigridGrammar.h" +#include "PrismPrinter.h" #include "PrismModulesPrinter.h" #include "PrismFormulaPrinter.h" #include "ConfigYaml.h" -struct GridOptions { - std::vector agentsToBeConsidered; - std::vector agentsWithView; - std::vector agentsWithProbabilisticBehaviour; - std::vector probabilitiesForActions; - bool enforceOneWays; - - prism::ModelType getModelType() const; -}; - class Grid { public: - Grid(cells gridCells, cells background, const GridOptions &gridOptions, const std::map &stateRewards = {}, const float probIntended = 1.0, const float faultyProbability = 0); + Grid(cells gridCells, cells background, const std::map &stateRewards = {}, const float probIntended = 1.0, const float faultyProbability = 0); cells getGridCells(); bool isBlocked(coordinates p); bool isWall(coordinates p); - void printToPrism(std::ostream &os, std::vector& configuration, const prism::ModelType& modelType); + void printToPrism(std::ostream &os, std::vector& configuration); void applyOverwrites(std::string& str, std::vector& configuration); std::array getWalkableDirOf8Neighborhood(cell c);