Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PcaaWeightVectorChecker.cpp
Go to the documentation of this file.
2
9
10namespace storm {
11namespace modelchecker {
12namespace multiobjective {
13
14template<typename ModelType>
15PcaaWeightVectorChecker<ModelType>::PcaaWeightVectorChecker(std::vector<Objective<ValueType>> const& objectives) : objectives(objectives) {
16 // Intentionally left empty
17}
18
19template<typename ModelType>
21 weightedPrecision = value;
22}
23
24template<typename ModelType>
26 STORM_LOG_THROW(weightedPrecision.has_value(), storm::exceptions::InvalidOperationException, "The weighted precision has not been set.");
27 return weightedPrecision.value();
28}
29
30template<typename ModelType>
34
35template<typename ModelType>
37 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Scheduler generation is not supported in this setting.");
38}
39
40template<class SparseModelType>
41boost::optional<typename SparseModelType::ValueType> PcaaWeightVectorChecker<SparseModelType>::computeWeightedResultBound(
42 bool lower, std::vector<ValueType> const& weightVector, storm::storage::BitVector const& objectiveFilter) const {
43 ValueType result = storm::utility::zero<ValueType>();
44 for (auto objIndex : objectiveFilter) {
45 boost::optional<ValueType> const& objBound = (lower == storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()))
46 ? this->objectives[objIndex].upperResultBound
47 : this->objectives[objIndex].lowerResultBound;
48 if (objBound) {
49 if (storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType())) {
50 result -= objBound.get() * weightVector[objIndex];
51 } else {
52 result += objBound.get() * weightVector[objIndex];
53 }
54 } else {
55 // If there is an objective without the corresponding bound we can not give guarantees for the weighted sum
56 return boost::none;
57 }
58 }
59 return result;
60}
61
62template<typename ModelType>
63std::unique_ptr<PcaaWeightVectorChecker<ModelType>> createWeightVectorChecker(
65 if constexpr (std::is_same_v<ModelType, storm::models::sparse::Mdp<typename ModelType::ValueType>>) {
66 if (preprocessorResult.containsRewardBoundedObjective()) {
67 return std::make_unique<RewardBoundedMdpPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
68 } else {
69 return std::make_unique<StandardMdpPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
70 }
71 } else {
72 static_assert(std::is_same_v<ModelType, storm::models::sparse::MarkovAutomaton<typename ModelType::ValueType>>);
73 STORM_LOG_THROW(!preprocessorResult.containsRewardBoundedObjective(), storm::exceptions::NotSupportedException,
74 "Reward-bounded objectives are not supported for multi-objective Markov automata.");
75 return std::make_unique<StandardMaPcaaWeightVectorChecker<ModelType>>(preprocessorResult);
76 }
77}
83
84template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::Mdp<double>>> createWeightVectorChecker(
86template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::Mdp<RationalNumber>>> createWeightVectorChecker(
88template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>> createWeightVectorChecker(
90template std::unique_ptr<PcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<RationalNumber>>> createWeightVectorChecker(
92
93} // namespace multiobjective
94} // namespace modelchecker
95} // 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.
virtual bool smallPrecisionsAreChallenging() const
Returns whether achieving precise values (i.e.
void setWeightedPrecision(ValueType const &value)
Sets the precision of this weight vector checker.
ValueType const & getWeightedPrecision() const
Returns the current precision of this weight vector checker as specified by setWeightedPrecision().
virtual storm::storage::Scheduler< ValueType > computeScheduler() const
Retrieves a scheduler that induces the current values (if such a scheduler was generated).
This class represents a Markov automaton.
This class represents a (discrete-time) Markov decision process.
Definition Mdp.h:13
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
This class defines which action is chosen in a particular state of a non-deterministic model.
Definition Scheduler.h:18
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
std::unique_ptr< PcaaWeightVectorChecker< ModelType > > createWeightVectorChecker(preprocessing::SparseMultiObjectivePreprocessorResult< ModelType > const &preprocessorResult)
bool constexpr minimize(OptimizationDirection d)