27 return labelOrExpression.which() == 0;
31 return boost::get<std::string>(labelOrExpression);
35 return labelOrExpression.which() == 1;
39 return boost::get<storm::expressions::Expression>(labelOrExpression);
43 : buildAllRewardModels(buildAllRewardModels),
44 buildAllLabels(buildAllLabels),
45 applyMaximalProgressAssumption(false),
46 buildChoiceLabels(false),
47 buildStateValuations(false),
48 buildObservationValuations(false),
49 buildChoiceOrigins(false),
50 scaleAndLiftTransitionRewards(true),
51 explorationChecks(false),
52 inferObservationsFromActions(false),
53 addOverlappingGuardsLabel(false),
54 addOutOfBoundsState(false),
55 reservedBitsForUnboundedVariables(32),
57 showProgressDelay(0) {
59 auto const& generalSettings = storm::settings::getModule<storm::settings::modules::GeneralSettings>();
60 stochasticTolerance = storm::utility::convertNumber<storm::RationalNumber>(generalSettings.getPrecision());
71 if (!formulas.empty()) {
72 for (
auto const& formula : formulas) {
75 if (formulas.size() == 1) {
80 auto const& generalSettings = storm::settings::getModule<storm::settings::modules::GeneralSettings>();
86 showProgress = generalSettings.isVerboseSet();
87 showProgressDelay = generalSettings.getShowProgressDelay();
98 for (
auto const& rewardModelName : referencedRewardModels) {
99 rewardModelNames.emplace(rewardModelName);
103 std::vector<std::shared_ptr<storm::logic::AtomicLabelFormula const>> atomicLabelFormulas = formula.
getAtomicLabelFormulas();
104 for (
auto const& formula : atomicLabelFormulas) {
109 std::vector<std::shared_ptr<storm::logic::AtomicExpressionFormula const>> atomicExpressionFormulas = formula.
getAtomicExpressionFormulas();
110 for (
auto const& formula : atomicExpressionFormulas) {
114 scaleAndLiftTransitionRewards =
121 [
this](std::string
const& label,
bool inverted) { this->
addTerminalLabel(label, inverted); });
125 return rewardModelNames;
133 return expressionLabels;
137 return terminalStates;
141 return !terminalStates.empty();
145 terminalStates.clear();
149 return applyMaximalProgressAssumption;
153 return buildChoiceLabels;
157 return buildStateValuations;
161 return buildObservationValuations;
165 return buildChoiceOrigins;
169 return buildAllRewardModels;
173 return buildAllLabels;
177 return inferObservationsFromActions;
181 return scaleAndLiftTransitionRewards;
185 return addOutOfBoundsState;
189 return reservedBitsForUnboundedVariables;
193 return addOverlappingGuardsLabel;
197 buildAllRewardModels = newValue;
202 return explorationChecks;
210 return showProgressDelay;
214 return stochasticTolerance;
218 explorationChecks = newValue;
223 STORM_LOG_THROW(!buildAllRewardModels, storm::exceptions::InvalidSettingsException,
"Cannot add reward model, because all reward models are built anyway.");
224 rewardModelNames.emplace(rewardModelName);
229 buildAllLabels = newValue;
234 std::stringstream stream;
235 stream << expression;
236 expressionLabels.emplace_back(stream.str(), expression);
241 STORM_LOG_THROW(!buildAllLabels, storm::exceptions::InvalidSettingsException,
"Cannot add label, because all labels are built anyway.");
242 labelNames.insert(labelName);
257 applyMaximalProgressAssumption = newValue;
262 buildChoiceLabels = newValue;
267 buildStateValuations = newValue;
272 buildObservationValuations = newValue;
277 buildChoiceOrigins = newValue;
282 scaleAndLiftTransitionRewards = newValue;
287 addOutOfBoundsState = newValue;
292 reservedBitsForUnboundedVariables = newValue;
297 addOverlappingGuardsLabel = newValue;
303 for (
auto& e : expressionLabels) {
304 e.second = substitutionFunction(e.second);
307 for (
auto& t : terminalStates) {
308 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? If not set, only required reward models are build.
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
storm::RationalNumber const & getStochasticTolerance() const
Some distributions may not sum to one.
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? If not set, only required reward models are build.
bool isBuildChoiceLabelsSet() const
bool isBuildChoiceOriginsSet() const
BuilderOptions & setBuildChoiceOrigins(bool newValue=true)
Should the origins the different choices be built?
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
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
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...
ModelType getModelType() const
#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.