#pragma once #include #include "storm/modelchecker/multiobjective/pcaa/PcaaWeightVectorChecker.h" #include "storm/modelchecker/prctl/helper/rewardbounded/MultiDimensionalRewardUnfolding.h" #include "storm/solver/MinMaxLinearEquationSolver.h" #include "storm/solver/LinearEquationSolver.h" #include "storm/utility/Stopwatch.h" namespace storm { namespace modelchecker { namespace multiobjective { /*! * Helper Class that takes preprocessed Pcaa data and a weight vector and ... * - computes the maximal expected reward w.r.t. the weighted sum of the rewards of the individual objectives * - extracts the scheduler that induces this maximum * - computes for each objective the value induced by this scheduler */ template class SparseMdpRewardBoundedPcaaWeightVectorChecker : public PcaaWeightVectorChecker { public: typedef typename SparseMdpModelType::ValueType ValueType; typedef typename SparseMdpModelType::RewardModelType RewardModelType; SparseMdpRewardBoundedPcaaWeightVectorChecker(SparseMultiObjectivePreprocessorResult const& preprocessorResult); virtual ~SparseMdpRewardBoundedPcaaWeightVectorChecker(); /*! * - computes the optimal expected reward w.r.t. the weighted sum of the rewards of the individual objectives * - extracts the scheduler that induces this optimum * - computes for each objective the value induced by this scheduler */ virtual void check(Environment const& env, std::vector const& weightVector) override; /*! * Retrieves the results of the individual objectives at the initial state of the given model. * Note that check(..) has to be called before retrieving results. Otherwise, an exception is thrown. * Also note that there is no guarantee that the under/over approximation is in fact correct * as long as the underlying solution methods are unsound (e.g., standard value iteration). */ virtual std::vector getUnderApproximationOfInitialStateResults() const override; virtual std::vector getOverApproximationOfInitialStateResults() const override; private: struct EpochCheckingData { std::vector bMinMax; std::vector xMinMax; std::unique_ptr> minMaxSolver; std::vector schedulerChoices; std::vector bLinEq; std::vector> xLinEq; std::unique_ptr> linEqSolver; std::vector::SolutionType> solutions; }; void computeEpochSolution(Environment const& env, typename helper::rewardbounded::MultiDimensionalRewardUnfolding::Epoch const& epoch, std::vector const& weightVector, EpochCheckingData& cachedData); void updateCachedData(Environment const& env, typename helper::rewardbounded::MultiDimensionalRewardUnfolding::EpochModel const& epochModel, EpochCheckingData& cachedData, std::vector const& weightVector); storm::utility::Stopwatch swAll, swEpochModelBuild, swEpochModelAnalysis; uint64_t numCheckedEpochs, numChecks; helper::rewardbounded::MultiDimensionalRewardUnfolding rewardUnfolding; boost::optional> underApproxResult; boost::optional> overApproxResult; }; } } }