23 return labelOrExpression.which() == 0;
27 return boost::get<std::string>(labelOrExpression);
31 return labelOrExpression.which() == 1;
35 return boost::get<storm::expressions::Expression>(labelOrExpression);
39 : buildAllRewardModels(buildAllRewardModels),
40 buildAllLabels(buildAllLabels),
41 applyMaximalProgressAssumption(false),
42 buildChoiceLabels(false),
43 buildStateValuations(false),
44 buildObservationValuations(false),
45 buildChoiceOrigins(false),
46 scaleAndLiftTransitionRewards(true),
47 explorationChecks(false),
48 inferObservationsFromActions(false),
49 addOverlappingGuardsLabel(false),
50 addOutOfBoundsState(false),
51 reservedBitsForUnboundedVariables(32),
54 stochasticTolerance(0.0) {
66 if (!formulas.empty()) {
67 for (auto const& formula : formulas) {
68 this->preserveFormula(*formula, modelDescription);
70 if (formulas.size() == 1) {
71 this->setTerminalStatesFromFormula(*formulas.front());
75 if (modelDescription.hasModel()) {
76 this->setApplyMaximalProgressAssumption(modelDescription.getModelType() == storm::storage::SymbolicModelDescription::ModelType::MA);
77 this->setBuildChoiceOrigins(modelDescription.getModelType() == storm::storage::SymbolicModelDescription::ModelType::POMDP);
78 this->setBuildChoiceLabels(modelDescription.getModelType() == storm::storage::SymbolicModelDescription::ModelType::POMDP);
90 for (
auto const& rewardModelName : referencedRewardModels) {
91 rewardModelNames.emplace(rewardModelName);
95 std::vector<std::shared_ptr<storm::logic::AtomicLabelFormula const>> atomicLabelFormulas = formula.
getAtomicLabelFormulas();
96 for (
auto const& formula : atomicLabelFormulas) {
101 std::vector<std::shared_ptr<storm::logic::AtomicExpressionFormula const>> atomicExpressionFormulas = formula.
getAtomicExpressionFormulas();
102 for (
auto const& formula : atomicExpressionFormulas) {
106 scaleAndLiftTransitionRewards =
113 [
this](std::string
const& label,
bool inverted) { this->
addTerminalLabel(label, inverted); });
117 return rewardModelNames;
125 return expressionLabels;
129 return terminalStates;
133 return !terminalStates.empty();
137 terminalStates.clear();
141 return applyMaximalProgressAssumption;
145 return buildChoiceLabels;
149 return buildStateValuations;
153 return buildObservationValuations;
157 return buildChoiceOrigins;
161 return buildAllRewardModels;
165 return buildAllLabels;
169 return inferObservationsFromActions;
173 return scaleAndLiftTransitionRewards;
177 return addOutOfBoundsState;
181 return reservedBitsForUnboundedVariables;
185 return addOverlappingGuardsLabel;
189 buildAllRewardModels = newValue;
194 return explorationChecks;
202 return showProgressDelay;
206 return stochasticTolerance;
210 explorationChecks = newValue;
215 STORM_LOG_THROW(!buildAllRewardModels, storm::exceptions::InvalidSettingsException,
"Cannot add reward model, because all reward models are built anyway.");
216 rewardModelNames.emplace(rewardModelName);
221 buildAllLabels = newValue;
226 std::stringstream stream;
227 stream << expression;
228 expressionLabels.emplace_back(stream.str(), expression);
233 STORM_LOG_THROW(!buildAllLabels, storm::exceptions::InvalidSettingsException,
"Cannot add label, because all labels are built anyway.");
234 labelNames.insert(labelName);
249 applyMaximalProgressAssumption = newValue;
254 buildChoiceLabels = newValue;
259 buildStateValuations = newValue;
264 buildObservationValuations = newValue;
269 buildChoiceOrigins = newValue;
274 scaleAndLiftTransitionRewards = newValue;
279 addOutOfBoundsState = newValue;
284 reservedBitsForUnboundedVariables = newValue;
289 addOverlappingGuardsLabel = newValue;
294 stochasticTolerance = newValue;
299 showProgress = newValue;
304 showProgressDelay = newValue;
310 for (
auto& e : expressionLabels) {
311 e.second = substitutionFunction(e.second);
314 for (
auto& t : terminalStates) {
315 if (t.first.isExpression()) {
uint64_t getReservedBitsForUnboundedVariables() const
bool isApplyMaximalProgressAssumptionSet() const
std::set< std::string > const & getRewardModelNames() const
Which reward models are built.
BuilderOptions & setBuildAllLabels(bool newValue=true)
Should all reward models be built?
BuilderOptions & setExplorationChecks(bool newValue=true)
Should extra checks be performed during exploration.
void clearTerminalStates()
BuilderOptions & addTerminalExpression(storm::expressions::Expression const &expression, bool value)
BuilderOptions & setAddOutOfBoundsState(bool newValue=true)
Should a state for out of bounds be constructed.
BuilderOptions & setReservedBitsForUnboundedVariables(uint64_t value)
Sets the number of bits that will be reserved for unbounded integer variables.
bool isScaleAndLiftTransitionRewardsSet() const
BuilderOptions & setBuildChoiceLabels(bool newValue=true)
Should the choice labels be built?
bool isBuildStateValuationsSet() const
BuilderOptions & addRewardModel(std::string const &rewardModelName)
Add an additional reward model to build.
bool isBuildAllRewardModelsSet() const
BuilderOptions & setBuildAllRewardModels(bool newValue=true)
Should all reward models be built?
bool isBuildChoiceLabelsSet() const
bool isBuildChoiceOriginsSet() const
BuilderOptions & setBuildChoiceOrigins(bool newValue=true)
Should the origins the different choices be built?
double getStochasticTolerance() const
Some distributions may not sum to one.
BuilderOptions & setShowProgressDelay(uint64_t newValue)
Sets the delay (in seconds) between progress reports during state space exploration.
bool isShowProgressSet() const
BuilderOptions & setBuildStateValuations(bool newValue=true)
Should the state valuation mapping be built?
BuilderOptions(bool buildAllRewardModels=false, bool buildAllLabels=false)
Creates an object representing the default options.
std::vector< std::pair< std::string, storm::expressions::Expression > > const & getExpressionLabels() const
Which expression labels are built.
BuilderOptions & substituteExpressions(std::function< storm::expressions::Expression(storm::expressions::Expression const &)> const &substitutionFunction)
Substitutes all expressions occurring in these options.
std::vector< std::pair< LabelOrExpression, bool > > const & getTerminalStates() const
bool isExplorationChecksSet() const
bool isBuildAllLabelsSet() const
BuilderOptions & setApplyMaximalProgressAssumption(bool newValue=true)
Should the maximal progress assumption be applied when building a Markov Automaton?
uint64_t getShowProgressDelay() const
BuilderOptions & setStochasticTolerance(double newValue)
Sets the tolerance used for checking whether a distribution sums to one.
bool isInferObservationsFromActionsSet() const
void preserveFormula(storm::logic::Formula const &formula, storm::storage::SymbolicModelDescription const &modelDescription=storm::storage::SymbolicModelDescription())
Changes the options in a way that ensures that the given formula can be checked on the model once it ...
bool hasTerminalStates() const
BuilderOptions & addLabel(storm::expressions::Expression const &expression)
bool isAddOverlappingGuardLabelSet() const
bool isAddOutOfBoundsStateSet() const
BuilderOptions & setBuildObservationValuations(bool newValue=true)
Should a observation valuation mapping be built?
void setTerminalStatesFromFormula(storm::logic::Formula const &formula)
Analyzes the given formula and sets an expression for the states states of the model that can be trea...
BuilderOptions & setAddOverlappingGuardsLabel(bool newValue=true)
Should a state be labelled for overlapping guards.
BuilderOptions & addTerminalLabel(std::string const &label, bool value)
BuilderOptions & setScaleAndLiftTransitionRewards(bool newValue=true)
Should extra checks be performed during exploration.
bool isBuildObservationValuationsSet() const
BuilderOptions & setShowProgress(bool newValue=true)
Sets whether the progress of state space exploration should be printed.
std::set< std::string > const & getLabelNames() const
Which labels are built.
LabelOrExpression(storm::expressions::Expression const &expression)
bool isExpression() const
storm::expressions::Expression const & getExpression() const
std::string const & getLabel() const
bool areTransitionRewardsLiftable(Formula const &f) const
Returns true, when lifting transition rewards to action rewards (by scaling with the transition proba...
#define STORM_LOG_THROW(cond, exception, message)
void getTerminalStatesFromFormula(storm::logic::Formula const &formula, std::function< void(storm::expressions::Expression const &, bool)> const &terminalExpressionCallback, std::function< void(std::string const &, bool)> const &terminalLabelCallback)
Traverses the formula.