1#ifndef STORM_MODELCHECKER_CHECKTASK_H_
2#define STORM_MODELCHECKER_CHECKTASK_H_
4#include <boost/optional.hpp>
22namespace modelchecker {
29template<
typename FormulaType = storm::logic::Formula,
typename ValueType =
double>
32 template<
typename OtherFormulaType,
typename OtherValueType>
39 this->onlyInitialStatesRelevant = onlyInitialStatesRelevant;
40 this->produceSchedulers =
false;
41 this->qualitative =
false;
42 this->robustUncertainty =
true;
51 template<
typename NewFormulaType>
54 this->onlyInitialStatesRelevant, this->bound, this->qualitative, this->produceSchedulers, this->hint,
55 this->robustUncertainty);
65 if (formula.get().isOperatorFormula()) {
72 this->bound = operatorFormula.
getBound();
77 }
else if (operatorFormula.
hasBound()) {
80 ? OptimizationDirection::Maximize
81 : OptimizationDirection::Minimize;
84 if (formula.get().isProbabilityOperatorFormula()) {
87 if (probabilityOperatorFormula.
hasBound()) {
90 this->qualitative =
true;
93 }
else if (formula.get().isRewardOperatorFormula()) {
97 if (rewardOperatorFormula.
hasBound()) {
99 this->qualitative =
true;
130 template<
typename NewValueType>
133 this->onlyInitialStatesRelevant, this->bound, this->qualitative, this->produceSchedulers, this->hint,
134 this->robustUncertainty);
141 return formula.get();
148 return static_cast<bool>(optimizationDirection);
155 return optimizationDirection.get();
162 optimizationDirection = dir;
169 return static_cast<bool>(playerCoalition);
176 return playerCoalition.get();
183 playerCoalition = coalition;
191 return static_cast<bool>(rewardModel);
198 return rewardModel.get();
205 return onlyInitialStatesRelevant;
212 this->onlyInitialStatesRelevant = value;
220 return static_cast<bool>(bound);
227 STORM_LOG_THROW(!bound.get().threshold.containsVariables(), storm::exceptions::InvalidOperationException,
228 "Cannot evaluate threshold '" << bound.get().threshold <<
"' as it contains undefined constants.");
229 return bound.get().template evaluateThresholdAs<ValueType>();
236 return bound.get().comparisonType;
273 this->produceSchedulers = produceSchedulers;
280 return produceSchedulers;
286 void setHint(std::shared_ptr<ModelCheckerHint>
const& hint) {
305 return this->substituteFormula<storm::logic::Formula>(this->
getFormula());
309 return robustUncertainty;
313 robustUncertainty = robust;
332 CheckTask(std::reference_wrapper<FormulaType const>
const& formula, boost::optional<storm::OptimizationDirection>
const& optimizationDirection,
333 boost::optional<storm::logic::PlayerCoalition> playerCoalition, boost::optional<std::string>
const& rewardModel,
bool onlyInitialStatesRelevant,
334 boost::optional<storm::logic::Bound>
const& bound,
bool qualitative,
bool produceSchedulers, std::shared_ptr<ModelCheckerHint>
const& hint,
337 optimizationDirection(optimizationDirection),
338 playerCoalition(playerCoalition),
339 rewardModel(rewardModel),
340 onlyInitialStatesRelevant(onlyInitialStatesRelevant),
342 qualitative(qualitative),
343 produceSchedulers(produceSchedulers),
345 robustUncertainty(robust) {
350 std::reference_wrapper<FormulaType const> formula;
353 boost::optional<storm::OptimizationDirection> optimizationDirection;
356 boost::optional<storm::logic::PlayerCoalition> playerCoalition;
359 boost::optional<std::string> rewardModel;
362 bool onlyInitialStatesRelevant;
365 boost::optional<storm::logic::Bound> bound;
372 bool produceSchedulers;
375 std::shared_ptr<ModelCheckerHint> hint;
378 bool robustUncertainty;
bool isBoundSet() const
Retrieves whether there is a bound with which the values for the states will be compared.
CheckTask< FormulaType, ValueType > & setOnlyInitialStatesRelevant(bool value=true)
Sets whether only initial states are relevant.
void setOptimizationDirection(storm::OptimizationDirection const &dir)
Sets the optimization direction.
ValueType getBoundThreshold() const
Retrieves the value of the bound (if set).
ModelCheckerHint & getHint()
storm::logic::ComparisonType const & getBoundComparisonType() const
Retrieves the comparison type of the bound (if set).
void setRobustUncertainty(bool robust=true)
bool isOptimizationDirectionSet() const
Retrieves whether an optimization direction was set.
CheckTask< NewFormulaType, ValueType > substituteFormula(NewFormulaType const &newFormula) const
Copies the check task from the source while replacing the formula with the new one.
CheckTask< FormulaType, ValueType > & setPlayerCoalition(storm::logic::PlayerCoalition const &coalition)
Sets the player coalition.
bool isRewardModelSet() const
Retrieves whether a reward model was set.
boost::optional< storm::logic::Bound > const & getOptionalBound() const
Retrieves the bound.
bool isQualitativeSet() const
Retrieves whether the computation only needs to be performed qualitatively, because the values will o...
std::string const & getRewardModel() const
Retrieves the reward model over which to perform the checking (if set).
FormulaType const & getFormula() const
Retrieves the formula from this task.
ModelCheckerHint const & getHint() const
Retrieves a hint that might contain information that speeds up the modelchecking process (if supporte...
CheckTask negate() const
Negate the optimization direction and the bound threshold, if those exist.
CheckTask< FormulaType, NewValueType > convertValueType() const
Copies the check task from the source while replacing the considered ValueType the new one.
void setHint(std::shared_ptr< ModelCheckerHint > const &hint)
sets a hint that might contain information that speeds up the modelchecking process (if supported by ...
bool isProduceSchedulersSet() const
Retrieves whether scheduler(s) are to be produced (if supported).
void setProduceSchedulers(bool produceSchedulers=true)
Sets whether to produce schedulers (if supported).
storm::logic::PlayerCoalition const & getPlayerCoalition() const
Retrieves the player coalition (if set).
CheckTask(FormulaType const &formula, bool onlyInitialStatesRelevant=false)
Creates a task object with the default options for the given formula.
storm::logic::Bound const & getBound() const
Retrieves the bound (if set).
storm::OptimizationDirection const & getOptimizationDirection() const
Retrieves the optimization direction (if set).
bool isPlayerCoalitionSet() const
Retrieves whether a player coalition was set.
bool isOnlyInitialStatesRelevantSet() const
Retrieves whether only the initial states are relevant in the computation.
void updateOperatorInformation()
If the currently specified formula is an OperatorFormula, this method updates the information that is...
void setQualitative(bool value)
sets whether the computation only needs to be performed qualitatively, because the values will only b...
bool getRobustUncertainty() const
This class contains information that might accelerate the model checking process.
#define STORM_LOG_THROW(cond, exception, message)
ComparisonType invertPreserveStrictness(ComparisonType t)
bool isOne(ValueType const &a)
bool isZero(ValueType const &a)