Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PcaaWeightVectorChecker.cpp
Go to the documentation of this file.
2
6
9
10namespace storm {
11namespace modelchecker {
12namespace multiobjective {
13
14template<typename ModelType>
16 : objectives(objectives), weightedPrecision(storm::utility::zero<ValueType>()) {
17 // Intentionally left empty
18}
19
20template<typename ModelType>
22 weightedPrecision = value;
23}
24
25template<typename ModelType>
29
30template<typename ModelType>
32 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Scheduler generation is not supported in this setting.");
33}
34
35template<class SparseModelType>
36boost::optional<typename SparseModelType::ValueType> PcaaWeightVectorChecker<SparseModelType>::computeWeightedResultBound(
37 bool lower, std::vector<ValueType> const& weightVector, storm::storage::BitVector const& objectiveFilter) const {
38 ValueType result = storm::utility::zero<ValueType>();
39 for (auto objIndex : objectiveFilter) {
40 boost::optional<ValueType> const& objBound = (lower == storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()))
41 ? this->objectives[objIndex].upperResultBound
42 : this->objectives[objIndex].lowerResultBound;
43 if (objBound) {
44 if (storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType())) {
45 result -= objBound.get() * weightVector[objIndex];
46 } else {
47 result += objBound.get() * weightVector[objIndex];
48 }
49 } else {
50 // If there is an objective without the corresponding bound we can not give guarantees for the weighted sum
51 return boost::none;
52 }
53 }
54 return result;
55}
56
57template<typename ModelType>
58template<typename VT, typename std::enable_if<std::is_same<ModelType, storm::models::sparse::Mdp<VT>>::value, int>::type>
59std::unique_ptr<PcaaWeightVectorChecker<ModelType>> WeightVectorCheckerFactory<ModelType>::create(
61 if (preprocessorResult.containsOnlyTrivialObjectives()) {
62 return std::make_unique<StandardMdpPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
63 } else {
64 STORM_LOG_DEBUG("Query contains reward bounded formula");
65 return std::make_unique<RewardBoundedMdpPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
66 }
67}
68
69template<typename ModelType>
70template<typename VT, typename std::enable_if<std::is_same<ModelType, storm::models::sparse::MarkovAutomaton<VT>>::value, int>::type>
71std::unique_ptr<PcaaWeightVectorChecker<ModelType>> WeightVectorCheckerFactory<ModelType>::create(
73 return std::make_unique<StandardMaPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
74}
75
80
85
86template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::Mdp<double>>> WeightVectorCheckerFactory<storm::models::sparse::Mdp<double>>::create(
88template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::Mdp<storm::RationalNumber>>>
91template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>>
94template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>>
97
98} // namespace multiobjective
99} // namespace modelchecker
100} // namespace storm
PcaaWeightVectorChecker(std::vector< Objective< ValueType > > const &objectives)
boost::optional< ValueType > computeWeightedResultBound(bool lower, std::vector< ValueType > const &weightVector, storm::storage::BitVector const &objectiveFilter) const
Computes the weighted lower or upper bounds for the provided set of objectives.
void setWeightedPrecision(ValueType const &value)
Sets the precision of this weight vector checker.
ValueType const & getWeightedPrecision() const
Returns the precision of this weight vector checker.
virtual storm::storage::Scheduler< ValueType > computeScheduler() const
Retrieves a scheduler that induces the current values (if such a scheduler was generated).
static std::unique_ptr< PcaaWeightVectorChecker< ModelType > > create(preprocessing::SparseMultiObjectivePreprocessorResult< ModelType > const &preprocessorResult)
This class represents a Markov automaton.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:14
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
This class defines which action is chosen in a particular state of a non-deterministic model.
Definition Scheduler.h:18
#define STORM_LOG_DEBUG(message)
Definition logging.h:23
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
bool constexpr minimize(OptimizationDirection d)
LabParser.cpp.
Definition cli.cpp:18