32template<
class SparseModelType>
39template<
class SparseModelType>
44 "There is no Pareto optimal scheduler that yields finite reward for all objectives. This is not supported.");
46 "There might be infinite reward for some scheduler. Multi-objective model checking restricts to schedulers that yield finite reward "
47 "for all objectives. Be aware that solutions yielding infinite reward are discarded.");
48 STORM_LOG_THROW(rewardAnalysis.totalRewardLessInfinityEStates, storm::exceptions::UnexpectedException,
49 "The set of states with reward < infinity for some scheduler has not been computed during preprocessing.");
51 "At least one objective was not reduced to an expected (long run, total or cumulative) reward objective during preprocessing. This is not "
52 "supported by the considered weight vector checker.");
54 "The model has multiple initial states.");
60 rewardAnalysis.totalRewardLessInfinityEStates.get(), rewardAnalysis.totalRewardLessInfinityEStates.get());
61 std::set<std::string> relevantRewardModels;
63 obj.formula->gatherReferencedRewardModels(relevantRewardModels);
68 std::vector<std::string>(relevantRewardModels.begin(), relevantRewardModels.end()), finiteTotalRewardChoices);
76 initialState = *mergerResult.model->getInitialStates().begin();
78 if (mergerResult.targetState) {
84 targetStateAsVector.set(*mergerResult.targetState,
true);
97 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
98 auto const& formula = *this->objectives[objIndex].formula;
99 if (formula.getSubformula().isTotalRewardFormula()) {
100 objectivesWithNoUpperTimeBound.set(objIndex,
true);
103 if (formula.getSubformula().isLongRunAverageRewardFormula()) {
104 lraObjectives.set(objIndex,
true);
105 objectivesWithNoUpperTimeBound.set(objIndex,
true);
130 uint64_t numLraMecStates = 0;
132 numLraMecStates += mec.size();
139template<
class SparseModelType>
144 STORM_LOG_THROW(std::any_of(weightVector.begin(), weightVector.end(), [](
auto const& w_i) { return !storm::utility::isZero(w_i); }),
145 storm::exceptions::InvalidOperationException,
"Weight vector must not be the zero vector.");
155 boost::optional<std::vector<ValueType>> weightedStateRewardVector;
158 storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()) ? -weightVector[objIndex] : weightVector[objIndex];
161 if (!weightedStateRewardVector) {
174 for (uint64_t objIndex : totalRewardObjectives) {
185 for (
auto const& obj : this->objectives) {
186 if (!obj.formula->getSubformula().isTotalRewardFormula() && !obj.formula->getSubformula().isLongRunAverageRewardFormula()) {
191 STORM_LOG_INFO(
"Weight vector check done. Lower bounds for results in initial state: "
195 for (uint64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
196 weightedSum += (
storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()) ? -weightVector[objIndex] : weightVector[objIndex]) *
202 "The desired precision was not reached: resulting precision "
203 << resultingWeightedPrecision <<
" exceeds specified value " << this->
getWeightedPrecision() <<
" by approx. "
214template<
class SparseModelType>
217 std::vector<ValueType> res;
218 res.reserve(this->objectives.size());
219 for (uint64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
225template<
class SparseModelType>
231template<
class SparseModelType>
235 "Tried to retrieve results but check(..) has not been called before.");
236 for (
auto const& obj : this->objectives) {
237 STORM_LOG_THROW(obj.formula->getSubformula().isTotalRewardFormula() || obj.formula->getSubformula().isLongRunAverageRewardFormula(),
238 storm::exceptions::NotImplementedException,
"Scheduler retrival is only implemented for objectives without time-bound.");
242 for (uint64_t inputModelState = 0; inputModelState < numStatesOfInputModel; ++inputModelState) {
248 auto const reducedModelChoice =
optimalChoices[reducedModelState];
250 result.
setChoice(inputModelChoice, inputModelState);
256template<
typename ValueType>
260 std::vector<uint64_t> stack;
262 stack.insert(stack.end(), processedStates.
begin(), processedStates.
end());
263 uint64_t currentState = 0;
265 while (!stack.empty()) {
266 currentState = stack.back();
269 for (
auto const& predecessorEntry : backwardTransitions.
getRow(currentState)) {
270 auto predecessor = predecessorEntry.getColumn();
271 if (consideredStates.
get(predecessor) && !processedStates.
get(predecessor)) {
275 uint64_t row = allowedChoices ? allowedChoices->getNextSetIndex(groupStart) : groupStart;
276 for (; row < groupEnd; row = allowedChoices ? allowedChoices->getNextSetIndex(row + 1) : row + 1) {
277 bool hasSuccessorInProcessedStates =
false;
278 for (
auto const& successorOfPredecessor : transitionMatrix.
getRow(row)) {
279 if (processedStates.
get(successorOfPredecessor.getColumn())) {
280 hasSuccessorInProcessedStates =
true;
284 if (hasSuccessorInProcessedStates) {
285 choices[predecessor] = row - groupStart;
286 processedStates.
set(predecessor,
true);
287 stack.push_back(predecessor);
292 "Unable to find choice at a predecessor of a processed state that leads to a processed state.");
299template<
typename ValueType>
303 for (uint64_t state : consideredStates) {
306 bool choiceFound =
false;
309 for (
auto const& element : transitionMatrix.
getRow(row)) {
310 if (statesToAvoid.
get(element.getColumn())) {
316 choices[state] = row - groupStart;
324template<
typename ValueType>
328 auto backwardsTransitions = matrix.
transpose(
true);
330 for (uint64_t state = 0; state < result.size(); ++state) {
331 if (rowsWithSumLessOne.
getNextSetIndex(groups[state]) < groups[state + 1]) {
332 result[state] = rowsWithSumLessOne.
getNextSetIndex(groups[state]) - groups[state];
333 processedStates.
set(state,
true);
346template<
typename ValueType>
350 auto badStates = transitionMatrix.
getRowGroupFilter(finitelyOftenChoices,
true) & ~safeStates;
354 transitionMatrix, transitionMatrix.
getRowGroupIndices(), backwardTransitions, ~safeStates, badStates,
false, 0, ~finitelyOftenChoices);
357 auto avoidBadStates = ~reachBadWithProbGreater0AStates & ~safeStates;
358 computeSchedulerProb0(transitionMatrix, backwardTransitions, avoidBadStates, reachBadWithProbGreater0AStates, ~finitelyOftenChoices, choices);
363 computeSchedulerProb1(transitionMatrix, backwardTransitions, reachBadWithProbGreater0AStates, avoidBadStates | safeStates, choices);
366template<
class SparseModelType>
368 std::vector<ValueType>
const& weightedActionRewardVector,
369 boost::optional<std::vector<ValueType>>
const& weightedStateRewardVector,
370 std::vector<ValueType>
const& weightVector) {
371 auto solverEnv = inputEnv;
379 solverEnv.solver().lra().setRelativeTerminationCriterion(
false);
384 helper.setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
385 helper.setProduceScheduler(
true);
388 auto actionValueGetter = [&weightedActionRewardVector](uint64_t
const& a) {
return weightedActionRewardVector[a]; };
390 if (weightedStateRewardVector) {
391 stateValueGetter = [&weightedStateRewardVector](uint64_t
const& s) {
return weightedStateRewardVector.get()[s]; };
395 lraMecDecomposition->auxMecValues[mecIndex] =
helper.computeLraForComponent(solverEnv, stateValueGetter, actionValueGetter, mec) + offset;
401template<
class SparseModelType>
403 std::vector<ValueType>
const& weightVector) {
405 auto solverEnv = inputEnv;
407 solverEnv.solver().lra().setRelativeTerminationCriterion(
false);
408 bool const requireSoundApproximation = !solverEnv.solver().isForceExact() && solverEnv.solver().isForceSoundness();
413 if (solverEnv.solver().isForceExact()) {
416 }
else if (requireSoundApproximation) {
417 adjustedPrecision /= two;
435 for (
auto const& sc : mec) {
436 statesInLraMec.
set(sc.first,
true);
442 this->optimalChoices);
450 std::map<uint64_t, uint64_t> ecqStateToOptimalMecMap;
459 uint64_t ecqState =
ecQuotient->originalToEcqStateMapping[mec.begin()->first];
460 if (ecqState >=
ecQuotient->matrix.getRowGroupCount()) {
465 uint64_t ecqChoice =
ecQuotient->ecqStayInEcChoices.getNextSetIndex(
ecQuotient->matrix.getRowGroupIndices()[ecqState]);
466 STORM_LOG_ASSERT(ecqChoice < ecQuotient->matrix.getRowGroupIndices()[ecqState + 1],
467 "Unable to find choice that represents staying inside the (eliminated) ec.");
468 auto& ecqChoiceValue =
ecQuotient->auxChoiceValues[ecqChoice];
469 auto insertionRes = ecqStateToOptimalMecMap.emplace(ecqState, mecIndex);
470 if (insertionRes.second) {
473 "Expected a total reward of zero for choices that represent staying in an EC for ever.");
474 ecqChoiceValue = mecValue;
476 if (mecValue > ecqChoiceValue) {
477 ecqChoiceValue = mecValue;
478 insertionRes.first->second = mecIndex;
484 std::unique_ptr<storm::solver::MinMaxLinearEquationSolver<ValueType>>
solver = solverFactory.
create(solverEnv,
ecQuotient->matrix);
485 solver->setTrackScheduler(
true);
486 solver->setHasUniqueSolution(
true);
487 solver->setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
488 auto req =
solver->getRequirements(solverEnv, storm::solver::OptimizationDirection::Maximize);
491 if (
solver->hasLowerBound()) {
492 req.clearLowerBounds();
494 if (
solver->hasUpperBound()) {
495 req.clearUpperBounds();
497 if (req.validInitialScheduler()) {
499 req.clearValidInitialScheduler();
501 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
502 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
503 solver->setRequirementsChecked(
true);
512 this->optimalChoices);
518template<
class SparseModelType>
520 auto solverEnv = inputEnv;
523 std::vector<ValueType> deterministicStateRewards(deterministicMatrix.
getRowCount());
525 bool const requireSoundApproximation = !solverEnv.solver().isForceExact() && solverEnv.solver().isForceSoundness();
529 if (solverEnv.solver().isForceExact()) {
532 }
else if (requireSoundApproximation) {
537 infiniteHorizonHelper.provideBackwardTransitions(deterministicBackwardTransitions);
541 std::vector<ValueType> weightedSumOfUncheckedObjectives =
weightedResult;
545 auto const& obj = this->objectives[objIndex];
553 solverEnv.solver().lra().setRelativeTerminationCriterion(
false);
556 auto actionValueGetter = [&](uint64_t
const& a) {
563 stateValueGetter = [&](uint64_t
const& s) {
return stateRewards[objIndex][s]; };
565 objectiveResults[objIndex] = infiniteHorizonHelper.computeLongRunAverageValues(solverEnv, stateValueGetter, actionValueGetter);
587 if (!maybeStates.
empty()) {
588 bool needEquationSystem =
591 if (needEquationSystem) {
602 std::unique_ptr<storm::solver::LinearEquationSolver<ValueType>>
solver = linearEquationSolverFactory.
create(solverEnv, submatrix);
603 auto req =
solver->getRequirements(solverEnv);
607 this->
setBoundsToSolver(*
solver, req.lowerBounds(), req.upperBounds(), objIndex, submatrix, submatrixRowsWithSumLessOne, b);
608 if (
solver->hasLowerBound()) {
609 req.clearLowerBounds();
611 if (
solver->hasUpperBound()) {
612 req.clearUpperBounds();
614 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
615 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
616 solver->solveEquations(solverEnv, x, b);
617 if (requireSoundApproximation) {
630 sumOfWeightsOfUncheckedObjectives -= weightVector[objIndex];
639template<
class SparseModelType>
649 for (
auto const& stateChoices : mec) {
650 for (
auto const& choice : stateChoices.second) {
651 zeroLraRewardChoices.
set(choice,
false);
660 auto nonZeroRewardStates =
transitionMatrix.getRowGroupFilter(newReward0Choices,
true);
661 nonZeroRewardStates.complement();
671 for (uint64_t row = 0; row < rowsWithSumLessOne.
size(); ++row) {
672 if (ecElimResult.matrix.getRow(row).getNumberOfEntries() == 0) {
673 rowsWithSumLessOne.
set(row,
true);
675 for (
auto const& entry :
transitionMatrix.getRow(ecElimResult.newToOldRowMapping[row])) {
676 if (!subsystemStates.
get(entry.getColumn())) {
677 rowsWithSumLessOne.
set(row,
true);
685 ecQuotient->matrix = std::move(ecElimResult.matrix);
686 ecQuotient->ecqToOriginalChoiceMapping = std::move(ecElimResult.newToOldRowMapping);
687 ecQuotient->originalToEcqStateMapping = std::move(ecElimResult.oldToNewStateMapping);
689 for (uint64_t state = 0; state <
ecQuotient->originalToEcqStateMapping.size(); ++state) {
690 uint64_t ecqState =
ecQuotient->originalToEcqStateMapping[state];
691 if (ecqState < ecQuotient->matrix.getRowGroupCount()) {
692 ecQuotient->ecqToOriginalStateMapping[ecqState].insert(state);
695 ecQuotient->ecqStayInEcChoices = std::move(ecElimResult.sinkRows);
696 ecQuotient->origReward0Choices = std::move(newReward0Choices);
697 ecQuotient->origTotalReward0Choices = std::move(newTotalReward0Choices);
698 ecQuotient->rowsWithSumLessOne = std::move(rowsWithSumLessOne);
704template<
class SparseModelType>
706 bool requiresUpper, uint64_t objIndex,
709 std::vector<ValueType>
const& rewards)
const {
711 if (this->objectives[objIndex].lowerResultBound) {
712 solver.setLowerBound(this->objectives[objIndex].lowerResultBound.get());
714 if (this->objectives[objIndex].upperResultBound) {
715 solver.setUpperBound(this->objectives[objIndex].upperResultBound.get());
718 if ((requiresLower && !
solver.hasLowerBound()) || (requiresUpper && !
solver.hasUpperBound())) {
723template<
class SparseModelType>
725 bool requiresUpper, std::vector<ValueType>
const& weightVector,
729 std::vector<ValueType>
const& rewards)
const {
736 lowerBound.get() += *min;
739 solver.setLowerBound(lowerBound.get());
746 upperBound.get() += *max;
749 solver.setUpperBound(upperBound.get());
752 if ((requiresLower && !
solver.hasLowerBound()) || (requiresUpper && !
solver.hasUpperBound())) {
757template<
class SparseModelType>
762 std::vector<ValueType>
const& rewards)
const {
765 for (uint64_t row : rowsWithSumLessOne) {
769 bool hasNegativeReward =
false;
770 bool hasPositiveReward =
false;
771 for (
auto const& rew : rewards) {
773 hasNegativeReward =
true;
775 hasPositiveReward =
true;
777 if (hasNegativeReward && hasPositiveReward) {
781 if (requiresLower && !
solver.hasLowerBound()) {
783 if (hasNegativeReward) {
785 std::vector<ValueType> tmpRewards(rewards.size());
788 std::vector<ValueType> lowerBounds =
791 solver.setLowerBounds(std::move(lowerBounds));
798 if (requiresUpper && !
solver.hasUpperBound()) {
799 if (hasPositiveReward) {
801 .computeTotalRewardBounds(rewards)
809template<
class SparseModelType>
811 std::vector<uint_fast64_t>
const& ecqOptimalChoices,
812 std::map<uint64_t, uint64_t>
const& ecqStateToOptimalMecMap,
813 std::vector<ValueType>& originalSolution,
814 std::vector<uint_fast64_t>& originalOptimalChoices)
const {
826 for (uint64_t ecqState = 0; ecqState < ecqSolution.size(); ++ecqState) {
827 uint64_t ecqChoice =
ecQuotient->matrix.getRowGroupIndices()[ecqState] + ecqOptimalChoices[ecqState];
828 uint_fast64_t origChoice =
ecQuotient->ecqToOriginalChoiceMapping[ecqChoice];
829 auto const& origStates =
ecQuotient->ecqToOriginalStateMapping[ecqState];
830 STORM_LOG_ASSERT(!origStates.empty(),
"Unexpected empty set of original states.");
831 if (
ecQuotient->ecqStayInEcChoices.get(ecqChoice)) {
834 if (!ecqStateToOptimalMecMap.empty()) {
837 STORM_LOG_ASSERT(ecqStateToOptimalMecMap.count(ecqState) > 0,
"No Lra Mec associated to given eliminated EC.");
839 if (lraMec.size() == origStates.size()) {
841 for (
auto const& state : origStates) {
842 STORM_LOG_ASSERT(lraMec.containsState(state),
"Expected state to be contained in the lra mec.");
844 unprocessedStates.
set(state,
false);
845 originalSolution[state] = ecqSolution[ecqState];
849 STORM_LOG_ASSERT(lraMec.size() < origStates.size(),
"Lra Mec (" << lraMec.size()
850 <<
" states) should be a proper subset of the eliminated ec ("
851 << origStates.size() <<
" states).");
852 for (
auto const& state : origStates) {
853 if (lraMec.containsState(state)) {
854 ecStatesToReach.
set(state,
true);
857 ecStatesToProcess.
set(state,
true);
859 unprocessedStates.
set(state,
false);
860 originalSolution[state] = ecqSolution[ecqState];
865 ecStatesToProcess.
clear();
866 ecStatesToReach.
clear();
872 bool needSchedulerComputation =
false;
874 "Solution for state that stays inside EC must be zero. Got " << ecqSolution[ecqState] <<
" instead.");
875 for (
auto const& state : origStates) {
877 ecStatesToProcess.
set(state,
true);
879 auto validChoices =
transitionMatrix.getRowFilter(ecStatesToProcess, ecStatesToProcess);
881 for (
auto const& state : origStates) {
884 auto nextValidChoice = valid0RewardChoices.getNextSetIndex(groupStart);
885 if (nextValidChoice < groupEnd) {
886 originalOptimalChoices[state] = nextValidChoice - groupStart;
889 ecStatesToAvoid.
set(state,
true);
890 needSchedulerComputation =
true;
893 if (needSchedulerComputation) {
895 auto ecStatesThatCanAvoid =
897 ecStatesToProcess, ecStatesToAvoid,
false, 0, valid0RewardChoices);
898 ecStatesThatCanAvoid.complement();
901 originalOptimalChoices);
906 ecStatesToAvoid.
clear();
907 ecStatesToProcess.
clear();
913 if (origStates.size() > 1) {
914 for (
auto const& state : origStates) {
918 if (origChoice >= groupStart && origChoice < groupEnd) {
919 originalOptimalChoices[state] = origChoice - groupStart;
920 ecStatesToReach.
set(state,
true);
922 STORM_LOG_ASSERT(origStates.size() > 1,
"Multiple original states expected.");
923 ecStatesToProcess.
set(state,
true);
925 unprocessedStates.
set(state,
false);
926 originalSolution[state] = ecqSolution[ecqState];
928 auto validChoices =
transitionMatrix.getRowFilter(ecStatesToProcess, ecStatesToProcess | ecStatesToReach);
931 ecStatesToProcess.
clear();
932 ecStatesToReach.
clear();
935 auto state = *origStates.begin();
938 origChoice >= groupStart && origChoice <
transitionMatrix.getRowGroupIndices()[state + 1],
939 "Invalid choice: " << originalOptimalChoices[state] <<
" at a state with " <<
transitionMatrix.getRowGroupSize(state) <<
" choices.");
940 originalOptimalChoices[state] = origChoice - groupStart;
941 originalSolution[state] = ecqSolution[ecqState];
942 unprocessedStates.
set(state,
false);
954 for (
auto const& sc : mec) {
955 if (unprocessedStates.
get(sc.first)) {
956 ecStatesToReach.
set(sc.first,
true);
966 unprocessedStates &= ~ecStatesToReach;
SolverEnvironment & solver()
void setRelativeTerminationCriterion(bool value)
MinMaxSolverEnvironment & minMax()
std::vector< ValueType > computeUpperBounds()
Computes upper bounds on the expected rewards.
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
SparseInfiniteHorizonHelper< ValueType, true >::ValueGetter ValueGetter
Function mapping from indices to values.
PcaaWeightVectorChecker(std::vector< Objective< ValueType > > const &objectives)
boost::optional< ValueType > computeWeightedResultBound(bool lower, std::vector< ValueType > const &weightVector, storm::storage::BitVector const &objectiveFilter) const
std::vector< Objective< ValueType > > objectives
ValueType const & getWeightedPrecision() const
Helper Class that takes preprocessed Pcaa data and a weight vector and ...
storm::storage::BitVector totalReward0EStates
ValueType getOptimalWeightedSum() const override
Retrieves the optimal weighted sum of the objective values (or an upper bound thereof).
std::vector< uint64_t > goalStateMergerReducedToInputChoiceMapping
void unboundedWeightedPhase(Environment const &env, std::vector< ValueType > const &weightedRewardVector, std::vector< ValueType > const &weightVector)
Determines the scheduler that optimizes the weighted reward vector of the unbounded objectives.
virtual void boundedPhase(Environment const &env, std::vector< ValueType > const &weightVector, std::vector< ValueType > &weightedRewardVector)=0
For each time epoch (starting with the maximal stepBound occurring in the objectives),...
std::vector< ValueType > offsetsToAchievablePoint
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createNondetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const =0
boost::optional< LraMecDecomposition > lraMecDecomposition
void computeAndSetBoundsToSolver(storm::solver::AbstractEquationSolver< ValueType > &solver, bool requiresLower, bool requiresUpper, storm::storage::SparseMatrix< ValueType > const &transitions, storm::storage::BitVector const &rowsWithSumLessOne, std::vector< ValueType > const &rewards) const
storm::storage::BitVector objectivesWithNoUpperTimeBound
virtual ValueType getWeightedPrecisionUnboundedPhase() const =0
virtual DeterministicInfiniteHorizonHelperType createDetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const =0
virtual std::vector< ValueType > getAchievablePoint() const override
Retrieves the result of the individual objectives at the initial state of the given model.
storm::storage::BitVector lraObjectives
storm::storage::SparseMatrix< ValueType > transitionMatrix
void infiniteHorizonWeightedPhase(Environment const &env, std::vector< ValueType > const &weightedActionRewardVector, boost::optional< std::vector< ValueType > > const &weightedStateRewardVector, std::vector< ValueType > const &weightVector)
std::vector< std::vector< ValueType > > actionRewards
StandardPcaaWeightVectorChecker(preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > const &preprocessorResult)
std::vector< std::vector< ValueType > > stateRewards
std::vector< ValueType > weightedResult
SparseModelType::ValueType ValueType
std::vector< std::vector< ValueType > > objectiveResults
boost::optional< EcQuotient > ecQuotient
std::vector< uint64_t > goalStateMergerInputToReducedStateIndexMapping
virtual void check(Environment const &env, std::vector< ValueType > weightVector) override
void transformEcqSolutionToOriginalModel(std::vector< ValueType > const &ecqSolution, std::vector< uint_fast64_t > const &ecqOptimalChoices, std::map< uint64_t, uint64_t > const &ecqStateToOptimalMecMap, std::vector< ValueType > &originalSolution, std::vector< uint_fast64_t > &originalOptimalChoices) const
Transforms the results of a min-max-solver that considers a reduced model (without end components) to...
storm::storage::BitVector ecChoicesHint
virtual void initializeModelTypeSpecificData(SparseMaModelType const &model)=0
virtual storm::storage::Scheduler< ValueType > computeScheduler() const override
Retrieves a scheduler that induces the current values Note that check(..) has to be called before ret...
storm::storage::BitVector actionsWithoutRewardInUnboundedPhase
std::vector< uint64_t > optimalChoices
ValueType offsetToWeightedSum
void updateEcQuotient(std::vector< ValueType > const &weightedRewardVector)
void initialize(preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > const &preprocessorResult)
void unboundedIndividualPhase(Environment const &env, std::vector< ValueType > const &weightVector)
Computes the values of the objectives that do not have a stepBound w.r.t.
void setBoundsToSolver(storm::solver::AbstractEquationSolver< ValueType > &solver, bool requiresLower, bool requiresUpper, uint64_t objIndex, storm::storage::SparseMatrix< ValueType > const &transitions, storm::storage::BitVector const &rowsWithSumLessOne, std::vector< ValueType > const &rewards) const
static ReturnType analyze(storm::modelchecker::multiobjective::preprocessing::SparseMultiObjectivePreprocessorResult< SparseModelType > const &preprocessorResult)
Analyzes the reward objectives of the multi objective query.
virtual std::unique_ptr< LinearEquationSolver< ValueType > > create(Environment const &env) const override
Creates an equation solver with the current settings, but without a matrix.
virtual std::unique_ptr< MinMaxLinearEquationSolver< ValueType, SolutionType > > create(Environment const &env) const override
virtual LinearEquationSolverProblemFormat getEquationProblemFormat(Environment const &env) const
Retrieves the problem format that the solver expects if it was created with the current settings.
A bit vector that is internally represented as a vector of 64-bit values.
void complement()
Negates all bits in the bit vector.
uint64_t getNextSetIndex(uint64_t startingIndex) const
Retrieves the index of the bit that is the next bit set to true in the bit vector.
const_iterator end() const
Returns an iterator pointing at the element past the back of the bit vector.
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
void clear()
Removes all set bits from the bit vector.
bool isSubsetOf(BitVector const &other) const
Checks whether all bits that are set in the current bit vector are also set in the given bit vector.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
size_t size() const
Retrieves the number of bits this bit vector can store.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
This class represents the decomposition of a nondeterministic model into its maximal end components.
This class defines which action is chosen in a particular state of a non-deterministic model.
void setChoice(SchedulerChoice< ValueType > const &choice, uint_fast64_t modelState, uint_fast64_t memoryState=0)
Sets the choice defined by the scheduler for the given state.
A class that holds a possibly non-square matrix in the compressed row storage format.
void convertToEquationSystem()
Transforms the matrix into an equation system.
const_rows getRow(index_type row) const
Returns an object representing the given row.
SparseMatrix getSubmatrix(bool useGroups, storm::storage::BitVector const &rowConstraint, storm::storage::BitVector const &columnConstraint, bool insertDiagonalEntries=false, storm::storage::BitVector const &makeZeroColumns=storm::storage::BitVector()) const
Creates a submatrix of the current matrix by dropping all rows and columns whose bits are not set to ...
value_type getRowSum(index_type row) const
Computes the sum of the entries in a given row.
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
storm::storage::BitVector getRowGroupFilter(storm::storage::BitVector const &rowConstraint, bool setIfForAllRowsInGroup) const
Returns the indices of all row groups selected by the row constraints.
std::vector< index_type > const & getRowGroupIndices() const
Returns the grouping of rows of this matrix.
storm::storage::SparseMatrix< value_type > transpose(bool joinGroups=false, bool keepZeros=false) const
Transposes the matrix.
index_type getRowCount() const
Returns the number of rows of the matrix.
storm::storage::BitVector getRowFilter(storm::storage::BitVector const &groupConstraint) const
Returns a bitvector representing the set of rows, with all indices set that correspond to one of the ...
#define STORM_LOG_INFO(message)
#define STORM_LOG_STATISTICS(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
std::vector< uint64_t > computeValidInitialScheduler(storm::storage::SparseMatrix< ValueType > const &matrix, storm::storage::BitVector const &rowsWithSumLessOne)
void computeSchedulerFinitelyOften(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &finitelyOftenChoices, storm::storage::BitVector safeStates, std::vector< uint64_t > &choices)
Computes a scheduler taking the choices from the given set only finitely often.
void computeSchedulerProb1(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &consideredStates, storm::storage::BitVector const &statesToReach, std::vector< uint64_t > &choices, storm::storage::BitVector const *allowedChoices=nullptr)
void computeSchedulerProb0(storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::SparseMatrix< ValueType > const &backwardTransitions, storm::storage::BitVector const &consideredStates, storm::storage::BitVector const &statesToAvoid, storm::storage::BitVector const &allowedChoices, std::vector< uint64_t > &choices)
bool constexpr maximize(OptimizationDirection d)
bool constexpr minimize(OptimizationDirection d)
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Performs a backward depth-first search trough the underlying graph structure of the given model to de...
storm::storage::BitVector performProbGreater0A(storm::storage::SparseMatrix< T > const &transitionMatrix, std::vector< uint_fast64_t > const &nondeterministicChoiceIndices, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps, boost::optional< storm::storage::BitVector > const &choiceConstraint)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under any pos...
storm::storage::BitVector performProbGreater0E(storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates, bool useStepBound, uint_fast64_t maximalSteps)
Computes the sets of states that have probability greater 0 of satisfying phi until psi under at leas...
storm::storage::BitVector performProb0E(storm::models::sparse::NondeterministicModel< T, RM > const &model, storm::storage::SparseMatrix< T > const &backwardTransitions, storm::storage::BitVector const &phiStates, storm::storage::BitVector const &psiStates)
Computes the sets of states that have probability 0 of satisfying phi until psi under at least one po...
std::vector< TargetType > convertNumericVector(std::vector< SourceType > const &oldVector)
Converts the given vector to the given ValueType Assumes that both, TargetType and SourceType are num...
T dotProduct(std::vector< T > const &firstOperand, std::vector< T > const &secondOperand)
Computes the dot product (aka scalar product) and returns the result.
void setVectorValues(std::vector< T > &vector, storm::storage::BitVector const &positions, std::vector< T > const &values)
Sets the provided values at the provided positions in the given vector.
void selectVectorValues(std::vector< T > &vector, storm::storage::BitVector const &positions, std::vector< T > const &values)
Selects the elements from a vector at the specified positions and writes them consecutively into anot...
void addScaledVector(std::vector< InValueType1 > &firstOperand, std::vector< InValueType2 > const &secondOperand, InValueType3 const &factor)
Computes x:= x + a*y, i.e., adds each element of the first vector and (the corresponding element of t...
std::string toString(std::vector< ValueType > const &vector)
Output vector as string.
void clip(std::vector< ValueType > &x, boost::optional< ValueType > const &lowerBound, boost::optional< ValueType > const &upperBound)
Takes the input vector and ensures that all entries conform to the bounds.
void applyPointwise(std::vector< InValueType1 > const &firstOperand, std::vector< InValueType2 > const &secondOperand, std::vector< OutValueType > &target, Operation f=Operation())
Applies the given operation pointwise on the two given vectors and writes the result to the third vec...
VT sum_if(std::vector< VT > const &values, storm::storage::BitVector const &filter)
Sum the entries from values that are set to one in the filter vector.
std::vector< uint_fast64_t > getSortedIndices(std::vector< T > const &v)
Returns a list of indices such that the first index refers to the highest entry of the given vector,...
storm::storage::BitVector filterZero(std::vector< T > const &values)
Retrieves a bit vector containing all the indices for which the value at this position is equal to ze...
void scaleVectorInPlace(std::vector< ValueType1 > &target, ValueType2 const &factor)
Multiplies each element of the given vector with the given factor and writes the result into the vect...
bool hasNonZeroEntry(std::vector< T > const &v)
std::vector< Type > filterVector(std::vector< Type > const &in, storm::storage::BitVector const &filter)
bool isOne(ValueType const &a)
bool isZero(ValueType const &a)
ValueType abs(ValueType const &number)
ValueType sqrt(ValueType const &number)
TargetType convertNumber(SourceType const &number)
std::shared_ptr< SparseModelType > preprocessedModel
bool containsRewardBoundedObjective() const