|
|
@ -14,14 +14,20 @@ namespace storm { |
|
|
|
namespace ir { |
|
|
|
|
|
|
|
// Initializes all members with their default constructors.
|
|
|
|
Program::Program() : modelType(UNDEFINED), booleanUndefinedConstantExpressions(), integerUndefinedConstantExpressions(), doubleUndefinedConstantExpressions(), modules(), rewards() { |
|
|
|
Program::Program() : modelType(UNDEFINED), booleanUndefinedConstantExpressions(), integerUndefinedConstantExpressions(), doubleUndefinedConstantExpressions(), modules(), rewards(), actions(), actionsToModuleIndexMap() { |
|
|
|
// Nothing to do here.
|
|
|
|
} |
|
|
|
|
|
|
|
// Initializes all members according to the given values.
|
|
|
|
Program::Program(ModelType modelType, std::map<std::string, std::shared_ptr<storm::ir::expressions::BooleanConstantExpression>> booleanUndefinedConstantExpressions, std::map<std::string, std::shared_ptr<storm::ir::expressions::IntegerConstantExpression>> integerUndefinedConstantExpressions, std::map<std::string, std::shared_ptr<storm::ir::expressions::DoubleConstantExpression>> doubleUndefinedConstantExpressions, std::vector<storm::ir::Module> modules, std::map<std::string, storm::ir::RewardModel> rewards, std::map<std::string, std::shared_ptr<storm::ir::expressions::BaseExpression>> labels) |
|
|
|
: modelType(modelType), booleanUndefinedConstantExpressions(booleanUndefinedConstantExpressions), integerUndefinedConstantExpressions(integerUndefinedConstantExpressions), doubleUndefinedConstantExpressions(doubleUndefinedConstantExpressions), modules(modules), rewards(rewards), labels(labels) { |
|
|
|
// Nothing to do here.
|
|
|
|
: modelType(modelType), booleanUndefinedConstantExpressions(booleanUndefinedConstantExpressions), integerUndefinedConstantExpressions(integerUndefinedConstantExpressions), doubleUndefinedConstantExpressions(doubleUndefinedConstantExpressions), modules(modules), rewards(rewards), labels(labels), actionsToModuleIndexMap() { |
|
|
|
// Build actionsToModuleIndexMap
|
|
|
|
for (unsigned int id = 0; id < this->modules.size(); id++) { |
|
|
|
for (auto action : this->modules[id].getActions()) { |
|
|
|
this->actionsToModuleIndexMap[action]->insert(id); |
|
|
|
this->actions.insert(action); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Program::ModelType Program::getModelType() const { |
|
|
@ -74,6 +80,21 @@ storm::ir::Module const& Program::getModule(uint_fast64_t index) const { |
|
|
|
return this->modules[index]; |
|
|
|
} |
|
|
|
|
|
|
|
// Return set of actions.
|
|
|
|
std::set<std::string> const& Program::getActions() const { |
|
|
|
return this->actions; |
|
|
|
} |
|
|
|
|
|
|
|
// Return modules with given action.
|
|
|
|
std::shared_ptr<std::set<uint_fast64_t>> const Program::getModulesByAction(std::string const& action) const { |
|
|
|
auto res = this->actionsToModuleIndexMap.find(action); |
|
|
|
if (res == this->actionsToModuleIndexMap.end()) { |
|
|
|
return std::shared_ptr<std::set<uint_fast64_t>>(new std::set<uint_fast64_t>()); |
|
|
|
} else { |
|
|
|
return res->second; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // namespace ir
|
|
|
|
|
|
|
|