14namespace modelchecker {
15namespace multiobjective {
17template<
class SparseModelType,
typename GeometryValueType>
20 :
SparsePcaaQuery<SparseModelType, GeometryValueType>(preprocessorResult) {
22 "Invalid query Type");
23 initializeThresholdData();
26 this->
weightVectorChecker->setWeightedPrecision(storm::utility::convertNumber<typename SparseModelType::ValueType>(0.1));
29template<
class SparseModelType,
typename GeometryValueType>
31 thresholds.reserve(this->objectives.size());
33 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
34 auto const& formula = *this->objectives[objIndex].formula;
35 STORM_LOG_ASSERT(formula.hasBound(),
"Achievability query invoked but there is an objective without bound.");
36 thresholds.push_back(formula.template getThresholdAs<GeometryValueType>());
41 thresholds.back() *= -storm::utility::one<GeometryValueType>();
47template<
class SparseModelType,
typename GeometryValueType>
49 STORM_LOG_THROW(!produceScheduler, storm::exceptions::NotImplementedException,
"Scheduler computation is not implement for achievability queries.");
51 bool result = this->checkAchievability(env);
56template<
class SparseModelType,
typename GeometryValueType>
60 WeightVector separatingVector = this->findSeparatingVector(thresholds);
61 this->updateWeightedPrecision(separatingVector);
62 this->performRefinementStep(env, std::move(separatingVector),
false);
63 if (!checkIfThresholdsAreSatisfied(this->overApproximation)) {
66 if (checkIfThresholdsAreSatisfied(this->underApproximation)) {
70 STORM_LOG_ERROR(
"Could not check whether thresholds are achievable: Termination requested or maximum number of refinement steps exceeded.");
74template<
class SparseModelType,
typename GeometryValueType>
75void SparsePcaaAchievabilityQuery<SparseModelType, GeometryValueType>::updateWeightedPrecision(WeightVector
const& weights) {
77 std::pair<Point, bool> optimizationResOverApprox = this->overApproximation->optimize(weights);
78 if (optimizationResOverApprox.second) {
79 std::pair<Point, bool> optimizationResUnderApprox = this->underApproximation->optimize(weights);
80 if (optimizationResUnderApprox.second) {
83 STORM_LOG_ASSERT(distance >= storm::utility::zero<GeometryValueType>(),
"Negative distance between under- and over approximation was not expected");
86 distance /= GeometryValueType(2);
87 this->weightVectorChecker->setWeightedPrecision(storm::utility::convertNumber<typename SparseModelType::ValueType>(distance));
93template<
class SparseModelType,
typename GeometryValueType>
94bool SparsePcaaAchievabilityQuery<SparseModelType, GeometryValueType>::checkIfThresholdsAreSatisfied(
96 std::vector<storm::storage::geometry::Halfspace<GeometryValueType>> halfspaces = polytope->getHalfspaces();
97 for (
auto const& h : halfspaces) {
100 if (h.isPointOnBoundary(thresholds)) {
101 for (
auto strictThreshold : strictThresholds) {
102 if (h.normalVector()[strictThreshold] > storm::utility::zero<GeometryValueType>()) {
114template class SparsePcaaAchievabilityQuery<storm::models::sparse::Mdp<double>, storm::RationalNumber>;
115template class SparsePcaaAchievabilityQuery<storm::models::sparse::MarkovAutomaton<double>, storm::RationalNumber>;
117template class SparsePcaaAchievabilityQuery<storm::models::sparse::Mdp<storm::RationalNumber>, storm::RationalNumber>;
118template class SparsePcaaAchievabilityQuery<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>, storm::RationalNumber>;
SparsePcaaAchievabilityQuery(preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > &preprocessorResult)
virtual std::unique_ptr< CheckResult > check(Environment const &env, bool produceScheduler) override
std::unique_ptr< PcaaWeightVectorChecker< SparseModelType > > weightVectorChecker
A bit vector that is internally represented as a vector of 64-bit values.
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
bool isLowerBound(ComparisonType t)
bool isStrict(ComparisonType t)
bool constexpr minimize(OptimizationDirection d)
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
T dotProduct(std::vector< T > const &firstOperand, std::vector< T > const &secondOperand)
Computes the dot product (aka scalar product) and returns the result.
bool isZero(ValueType const &a)
ValueType sqrt(ValueType const &number)