14namespace modelchecker {
15namespace multiobjective {
17template<
class SparseModelType,
typename GeometryValueType>
20 :
SparsePcaaQuery<SparseModelType, GeometryValueType>(preprocessorResult) {
22 "Invalid query Type");
25template<
class SparseModelType,
typename GeometryValueType>
28 storm::exceptions::IllegalArgumentException,
"Unhandled multiobjective precision type.");
31 typename SparseModelType::ValueType weightedPrecision =
33 weightedPrecision /=
storm::utility::sqrt(storm::utility::convertNumber<typename SparseModelType::ValueType, uint_fast64_t>(this->objectives.size()));
38 weightedPrecision *= storm::utility::convertNumber<typename SparseModelType::ValueType>(0.9);
39 this->weightVectorChecker->setWeightedPrecision(weightedPrecision);
42 exploreSetOfAchievablePoints(env, produceScheduler);
45 std::vector<std::vector<typename SparseModelType::ValueType>> paretoOptimalPoints;
46 std::vector<storm::storage::Scheduler<typename SparseModelType::ValueType>> paretoOptimalSchedulers;
47 std::vector<Point> vertices = this->underApproximation->getVertices();
48 paretoOptimalPoints.reserve(vertices.size());
49 for (
auto const& vertex : vertices) {
50 paretoOptimalPoints.push_back(
52 if (produceScheduler) {
55 auto stepIt = std::find_if(this->refinementSteps.begin(), this->refinementSteps.end(),
56 [&vertex](
auto const& step) { return step.lowerBoundPoint == vertex; });
57 STORM_LOG_THROW(stepIt != this->refinementSteps.end(), storm::exceptions::UnexpectedException,
61 paretoOptimalSchedulers.push_back(std::move(stepIt->scheduler.value()));
65 this->originalModel.getInitialStates().getNextSetIndex(0), std::move(paretoOptimalPoints), std::move(paretoOptimalSchedulers),
67 ->
template convertNumberRepresentation<typename SparseModelType::ValueType>(),
69 ->
template convertNumberRepresentation<typename SparseModelType::ValueType>()));
72template<
class SparseModelType,
typename GeometryValueType>
75 storm::exceptions::IllegalArgumentException,
"Unhandled multiobjective precision type.");
78 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size() && !this->maxStepsPerformed(env); ++objIndex) {
79 WeightVector direction(this->objectives.size(), storm::utility::zero<GeometryValueType>());
80 direction[objIndex] = storm::utility::one<GeometryValueType>();
81 this->performRefinementStep(env, std::move(direction), produceScheduler);
89 std::vector<storm::storage::geometry::Halfspace<GeometryValueType>> underApproxHalfspaces = this->underApproximation->getHalfspaces();
90 std::vector<Point> overApproxVertices = this->overApproximation->getVertices();
91 uint_fast64_t farestHalfspaceIndex = underApproxHalfspaces.size();
92 GeometryValueType farestDistance = storm::utility::zero<GeometryValueType>();
93 for (uint_fast64_t halfspaceIndex = 0; halfspaceIndex < underApproxHalfspaces.size(); ++halfspaceIndex) {
94 for (
auto const& vertex : overApproxVertices) {
95 GeometryValueType distance = underApproxHalfspaces[halfspaceIndex].euclideanDistance(vertex);
96 if (distance > farestDistance) {
97 farestHalfspaceIndex = halfspaceIndex;
98 farestDistance = distance;
106 STORM_LOG_INFO(
"Current precision of the approximation of the pareto curve is ~" << storm::utility::convertNumber<double>(farestDistance));
107 WeightVector direction = underApproxHalfspaces[farestHalfspaceIndex].normalVector();
108 this->performRefinementStep(env, std::move(direction), produceScheduler);
110 STORM_LOG_ERROR(
"Could not reach the desired precision: Termination requested or maximum number of refinement steps exceeded.");
113#ifdef STORM_HAVE_CARL
114template class SparsePcaaParetoQuery<storm::models::sparse::Mdp<double>, storm::RationalNumber>;
115template class SparsePcaaParetoQuery<storm::models::sparse::MarkovAutomaton<double>, storm::RationalNumber>;
117template class SparsePcaaParetoQuery<storm::models::sparse::Mdp<storm::RationalNumber>, storm::RationalNumber>;
118template class SparsePcaaParetoQuery<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>, storm::RationalNumber>;
ModelCheckerEnvironment & modelchecker()
MultiObjectiveModelCheckerEnvironment & multi()
storm::RationalNumber const & getPrecision() const
PrecisionType const & getPrecisionType() const
virtual std::unique_ptr< CheckResult > check(Environment const &env, bool produceScheduler) override
SparsePcaaParetoQuery(preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > &preprocessorResult)
#define STORM_LOG_INFO(message)
#define STORM_LOG_ERROR(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
std::vector< GeometryValueType > transformObjectiveValuesToOriginal(std::vector< Objective< ValueType > > objectives, std::vector< GeometryValueType > const &point)
std::shared_ptr< storm::storage::geometry::Polytope< GeometryValueType > > transformObjectivePolytopeToOriginal(std::vector< Objective< ValueType > > objectives, std::shared_ptr< storm::storage::geometry::Polytope< GeometryValueType > > const &polytope)
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
std::string toString(std::vector< ValueType > const &vector)
Output vector as string.
ValueType sqrt(ValueType const &number)