24namespace modelchecker {
25namespace multiobjective {
27template<
class SparseMaModelType>
34template<
class SparseMaModelType>
36 markovianStates = model.getMarkovianStates();
37 exitRates = model.getExitRates();
40 this->actionRewards.assign(this->objectives.size(), {});
41 this->stateRewards.assign(this->objectives.size(), {});
42 for (uint64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
43 auto const& formula = *this->objectives[objIndex].formula;
44 STORM_LOG_THROW(formula.isRewardOperatorFormula() && formula.asRewardOperatorFormula().hasRewardModelName(), storm::exceptions::UnexpectedException,
45 "Unexpected type of operator formula: " << formula);
46 typename SparseMaModelType::RewardModelType
const& rewModel = model.getRewardModel(formula.asRewardOperatorFormula().getRewardModelName());
47 STORM_LOG_ASSERT(!rewModel.hasTransitionRewards(),
"Preprocessed Reward model has transition rewards which is not expected.");
48 this->actionRewards[objIndex] = rewModel.hasStateActionRewards()
49 ? rewModel.getStateActionRewardVector()
50 : std::vector<ValueType>(model.getTransitionMatrix().getRowCount(), storm::utility::zero<ValueType>());
51 if (formula.getSubformula().isTotalRewardFormula()) {
52 if (rewModel.hasStateRewards()) {
54 for (
auto markovianState : markovianStates) {
55 this->actionRewards[objIndex][model.getTransitionMatrix().getRowGroupIndices()[markovianState]] +=
56 rewModel.getStateReward(markovianState) / exitRates[markovianState];
59 }
else if (formula.getSubformula().isLongRunAverageRewardFormula()) {
61 if (rewModel.hasStateRewards()) {
62 this->stateRewards[objIndex] = rewModel.getStateRewardVector();
66 formula.getSubformula().asCumulativeRewardFormula().getTimeBoundReference().isTimeBound(),
67 storm::exceptions::UnexpectedException,
"Unexpected type of sub-formula: " << formula.getSubformula());
68 STORM_LOG_THROW(!rewModel.hasStateRewards(), storm::exceptions::InvalidPropertyException,
69 "Found state rewards for time bounded objective " << this->objectives[objIndex].originalFormula <<
". This is not supported.");
71 this->objectives[objIndex].originalFormula->isProbabilityOperatorFormula() &&
72 this->objectives[objIndex].originalFormula->asProbabilityOperatorFormula().getSubformula().isBoundedUntilFormula(),
73 "Objective " << this->objectives[objIndex].originalFormula
74 <<
" was simplified to a cumulative reward formula. Correctness of the algorithm is unknown for this type of property.");
79 STORM_PRINT_AND_LOG(
"Final preprocessed model has " << markovianStates.getNumberOfSetBits() <<
" Markovian states.\n");
83template<
class SparseMdpModelType>
90template<
class SparseMdpModelType>
96 result.setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
100template<
class SparseMaModelType>
102 std::vector<ValueType>& weightedRewardVector) {
104 SubModel MS = createSubModel(
true, weightedRewardVector);
105 SubModel PS = createSubModel(
false, weightedRewardVector);
108 ValueType digitizationConstant = getDigitizationConstant(weightVector);
109 digitize(MS, digitizationConstant);
112 TimeBoundMap upperTimeBounds;
113 digitizeTimeBounds(upperTimeBounds, digitizationConstant);
120 std::unique_ptr<MinMaxSolverData> minMax = initMinMaxSolver(env, PS, acyclic, weightVector);
124 std::unique_ptr<LinEqSolverData> linEq = initLinEqSolver(env, PS, acyclic);
127 std::vector<uint_fast64_t> optimalChoicesAtCurrentEpoch(PS.getNumberOfStates(), std::numeric_limits<uint_fast64_t>::max());
132 auto upperTimeBoundIt = upperTimeBounds.
begin();
133 uint_fast64_t currentEpoch = upperTimeBounds.empty() ? 0 : upperTimeBoundIt->first;
136 updateDataToCurrentEpoch(MS, PS, *minMax, consideredObjectives, currentEpoch, weightVector, upperTimeBoundIt, upperTimeBounds);
139 performPSStep(env, PS, MS, *minMax, *linEq, optimalChoicesAtCurrentEpoch, consideredObjectives, weightVector);
143 if (currentEpoch > 0) {
144 performMSStep(env, MS, PS, consideredObjectives, weightVector);
155 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
161template<
class SparseMaModelType>
162typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::SubModel StandardMaPcaaWeightVectorChecker<SparseMaModelType>::createSubModel(
163 bool createMS, std::vector<ValueType>
const& weightedRewardVector)
const {
167 result.states = createMS ? markovianStates : probabilisticStates;
168 result.choices = this->transitionMatrix.getRowFilter(result.states);
169 STORM_LOG_ASSERT(!createMS || result.states.getNumberOfSetBits() == result.choices.getNumberOfSetBits(),
170 "row groups for Markovian states should consist of exactly one row");
173 result.toMS = this->transitionMatrix.getSubmatrix(
true, result.states, markovianStates, createMS);
174 result.toPS = this->transitionMatrix.getSubmatrix(
true, result.states, probabilisticStates,
false);
175 STORM_LOG_ASSERT(result.getNumberOfStates() == result.states.getNumberOfSetBits() && result.getNumberOfStates() == result.toMS.getRowGroupCount() &&
176 result.getNumberOfStates() == result.toPS.getRowGroupCount(),
177 "Invalid state count for subsystem");
178 STORM_LOG_ASSERT(result.getNumberOfChoices() == result.choices.getNumberOfSetBits() && result.getNumberOfChoices() == result.toMS.getRowCount() &&
179 result.getNumberOfChoices() == result.toPS.getRowCount(),
180 "Invalid choice count for subsystem");
182 result.weightedRewardVector.resize(result.getNumberOfChoices());
184 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
185 std::vector<ValueType>
const& objRewards = this->actionRewards[objIndex];
186 std::vector<ValueType> subModelObjRewards;
187 subModelObjRewards.reserve(result.getNumberOfChoices());
188 for (
auto choice : result.choices) {
189 subModelObjRewards.push_back(objRewards[choice]);
191 result.objectiveRewardVectors.push_back(std::move(subModelObjRewards));
194 result.weightedSolutionVector.resize(result.getNumberOfStates());
196 result.objectiveSolutionVectors.resize(this->objectives.size());
197 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
198 result.objectiveSolutionVectors[objIndex].resize(result.weightedSolutionVector.size());
202 result.auxChoiceValues.resize(result.getNumberOfChoices());
207template<
class SparseMaModelType>
208template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
209VT StandardMaPcaaWeightVectorChecker<SparseMaModelType>::getDigitizationConstant(std::vector<ValueType>
const& weightVector)
const {
222 std::vector<VT> timeBounds;
223 std::vector<VT> eToPowerOfMinusMaxRateTimesBound;
224 VT smallestNonZeroBound = storm::utility::zero<VT>();
225 for (
auto const& obj : this->objectives) {
226 if (obj.formula->getSubformula().isCumulativeRewardFormula()) {
227 timeBounds.push_back(obj.formula->getSubformula().asCumulativeRewardFormula().template getBound<VT>());
229 "Got zero-valued upper time bound. This is not suppoted.");
230 eToPowerOfMinusMaxRateTimesBound.push_back(std::exp(-maxRate * timeBounds.back()));
231 smallestNonZeroBound =
storm::utility::isZero(smallestNonZeroBound) ? timeBounds.back() : std::min(smallestNonZeroBound, timeBounds.back());
233 timeBounds.push_back(storm::utility::zero<VT>());
234 eToPowerOfMinusMaxRateTimesBound.push_back(storm::utility::zero<VT>());
239 return storm::utility::one<VT>();
247 uint_fast64_t smallestStepBound = 1;
248 VT delta = smallestNonZeroBound / smallestStepBound;
250 bool deltaValid =
true;
251 for (
auto objIndex : objectivesWithTimeBound) {
252 auto const& timeBound = timeBounds[objIndex];
253 if (timeBound / delta != std::floor(timeBound / delta)) {
259 VT weightedPrecisionForCurrentDelta = storm::utility::zero<VT>();
260 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
261 VT precisionOfObj = storm::utility::zero<VT>();
262 if (objectivesWithTimeBound.
get(objIndex)) {
264 storm::utility::one<VT>() - (eToPowerOfMinusMaxRateTimesBound[objIndex] *
265 storm::utility::pow(storm::utility::one<VT>() + maxRate * delta, timeBounds[objIndex] / delta));
267 weightedPrecisionForCurrentDelta += weightVector[objIndex] * precisionOfObj;
269 deltaValid &= weightedPrecisionForCurrentDelta <= goalPrecisionTimesNorm;
275 STORM_LOG_ASSERT(delta > smallestNonZeroBound / smallestStepBound,
"Digitization constant is expected to become smaller in every iteration");
276 delta = smallestNonZeroBound / smallestStepBound;
278 STORM_LOG_DEBUG(
"Found digitization constant: " << delta <<
". At least " << smallestStepBound <<
" digitization steps will be necessarry");
282template<
class SparseMaModelType>
283template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
284VT StandardMaPcaaWeightVectorChecker<SparseMaModelType>::getDigitizationConstant(std::vector<ValueType>
const& )
const {
285 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
288template<
class SparseMaModelType>
289template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
290void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitize(SubModel& MS, VT
const& digitizationConstant)
const {
291 std::vector<VT> rateVector(MS.getNumberOfChoices());
293 for (uint_fast64_t row = 0; row < rateVector.size(); ++row) {
294 VT
const eToMinusRateTimesDelta = std::exp(-rateVector[row] * digitizationConstant);
295 for (
auto& entry : MS.toMS.getRow(row)) {
296 entry.setValue((storm::utility::one<VT>() - eToMinusRateTimesDelta) * entry.getValue());
297 if (entry.getColumn() == row) {
298 entry.setValue(entry.getValue() + eToMinusRateTimesDelta);
301 for (
auto& entry : MS.toPS.getRow(row)) {
302 entry.setValue((storm::utility::one<VT>() - eToMinusRateTimesDelta) * entry.getValue());
304 MS.weightedRewardVector[row] *= storm::utility::one<VT>() - eToMinusRateTimesDelta;
305 for (
auto& objVector : MS.objectiveRewardVectors) {
306 objVector[row] *= storm::utility::one<VT>() - eToMinusRateTimesDelta;
311template<
class SparseMaModelType>
312template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
313void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitize(SubModel& , VT
const& )
const {
314 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
317template<
class SparseMaModelType>
318template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
319void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitizeTimeBounds(TimeBoundMap& upperTimeBounds, VT
const& digitizationConstant) {
321 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
322 auto const& obj = this->objectives[objIndex];
323 VT errorTowardsZero = storm::utility::zero<VT>();
324 VT errorAwayFromZero = storm::utility::zero<VT>();
325 if (obj.formula->getSubformula().isCumulativeRewardFormula()) {
326 VT timeBound = obj.formula->getSubformula().asCumulativeRewardFormula().template getBound<VT>();
327 uint_fast64_t digitizedBound = storm::utility::convertNumber<uint_fast64_t>(timeBound / digitizationConstant);
328 auto timeBoundIt = upperTimeBounds.insert(std::make_pair(digitizedBound,
storm::storage::BitVector(this->objectives.size(),
false))).first;
329 timeBoundIt->second.set(objIndex);
330 VT digitizationError = storm::utility::one<VT>();
332 std::exp(-maxRate * timeBound) *
storm::utility::pow(storm::utility::one<VT>() + maxRate * digitizationConstant, digitizedBound);
333 errorAwayFromZero += digitizationError;
336 this->offsetsToUnderApproximation[objIndex] = -errorTowardsZero;
337 this->offsetsToOverApproximation[objIndex] = errorAwayFromZero;
339 this->offsetsToUnderApproximation[objIndex] = errorAwayFromZero;
340 this->offsetsToOverApproximation[objIndex] = -errorTowardsZero;
345template<
class SparseMaModelType>
346template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
347void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitizeTimeBounds(TimeBoundMap& , VT
const& ) {
348 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
351template<
class SparseMaModelType>
352std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::MinMaxSolverData>
353StandardMaPcaaWeightVectorChecker<SparseMaModelType>::initMinMaxSolver(Environment
const& env, SubModel
const& PS,
bool acyclic,
354 std::vector<ValueType>
const& weightVector)
const {
355 std::unique_ptr<MinMaxSolverData> result(
new MinMaxSolverData());
356 result->env = std::make_unique<storm::Environment>(env);
359 result->env->solver().minMax().setMethod(storm::solver::MinMaxMethod::Acyclic);
362 result->solver = minMaxSolverFactory.
create(*result->env, PS.toPS);
363 result->solver->setHasUniqueSolution(
true);
364 result->solver->setHasNoEndComponents(
true);
365 result->solver->setTrackScheduler(
true);
366 result->solver->setCachingEnabled(
true);
367 auto req = result->solver->getRequirements(*result->env, storm::solver::OptimizationDirection::Maximize,
false);
368 boost::optional<ValueType> lowerBound = this->computeWeightedResultBound(
true, weightVector,
storm::storage::BitVector(weightVector.size(),
true));
370 result->solver->setLowerBound(lowerBound.get());
371 req.clearLowerBounds();
373 boost::optional<ValueType> upperBound = this->computeWeightedResultBound(
false, weightVector,
storm::storage::BitVector(weightVector.size(),
true));
375 result->solver->setUpperBound(upperBound.get());
376 req.clearUpperBounds();
381 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
382 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
383 result->solver->setRequirementsChecked(
true);
384 result->solver->setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
386 result->b.resize(PS.getNumberOfChoices());
391template<
class SparseMaModelType>
392template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
393std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::LinEqSolverData>
395 std::unique_ptr<LinEqSolverData> result(
new LinEqSolverData());
396 result->env = std::make_unique<Environment>(env);
397 result->acyclic = acyclic;
400 result->env->solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Acyclic);
402 result->factory = std::make_unique<storm::solver::GeneralLinearEquationSolverFactory<ValueType>>();
403 result->b.resize(PS.getNumberOfStates());
407template<
class SparseMaModelType>
408template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
409std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::LinEqSolverData>
411 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
414template<
class SparseMaModelType>
415void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::updateDataToCurrentEpoch(
416 SubModel& MS, SubModel& PS, MinMaxSolverData& minMax,
storm::storage::BitVector& consideredObjectives, uint_fast64_t
const& currentEpoch,
417 std::vector<ValueType>
const& weightVector, TimeBoundMap::iterator& upperTimeBoundIt, TimeBoundMap
const& upperTimeBounds) {
418 if (upperTimeBoundIt != upperTimeBounds.end() && currentEpoch == upperTimeBoundIt->first) {
419 consideredObjectives |= upperTimeBoundIt->second;
420 for (
auto objIndex : upperTimeBoundIt->second) {
423 storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()) ? -weightVector[objIndex] : weightVector[objIndex];
431 PS.toMS.multiplyWithVector(MS.weightedSolutionVector, minMax.b);
435template<
class SparseMaModelType>
436void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::performPSStep(Environment
const& env, SubModel& PS, SubModel
const& MS, MinMaxSolverData& minMax,
437 LinEqSolverData& linEq, std::vector<uint_fast64_t>& optimalChoicesAtCurrentEpoch,
439 std::vector<ValueType>
const& weightVector)
const {
441 minMax.solver->solveEquations(*minMax.env, PS.weightedSolutionVector, minMax.b);
442 auto const& newChoices = minMax.solver->getSchedulerChoices();
445 optimalChoicesAtCurrentEpoch = newChoices;
446 PS.objectiveSolutionVectors[*consideredObjectives.
begin()] = PS.weightedSolutionVector;
452 if (linEq.solver ==
nullptr || newChoices != optimalChoicesAtCurrentEpoch) {
453 optimalChoicesAtCurrentEpoch = newChoices;
454 linEq.solver =
nullptr;
457 if (needEquationSystem) {
460 linEq.solver = linEq.factory->create(*linEq.env, std::move(linEqMatrix));
461 linEq.solver->setCachingEnabled(
true);
462 auto req = linEq.solver->getRequirements(*linEq.env);
466 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
467 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
473 for (
auto objIndex : consideredObjectives) {
474 auto const& objectiveRewardVectorPS = PS.objectiveRewardVectors[objIndex];
475 auto const& objectiveSolutionVectorMS = MS.objectiveSolutionVectors[objIndex];
478 auto itGroupIndex = PS.toPS.getRowGroupIndices().begin();
479 auto itChoiceOffset = optimalChoicesAtCurrentEpoch.begin();
480 for (
auto& bValue : linEq.b) {
481 uint_fast64_t row = (*itGroupIndex) + (*itChoiceOffset);
482 bValue = objectiveRewardVectorPS[row];
483 for (
auto const& entry : PS.toMS.getRow(row)) {
484 bValue += entry.getValue() * objectiveSolutionVectorMS[entry.getColumn()];
489 linEq.solver->solveEquations(*linEq.env, PS.objectiveSolutionVectors[objIndex], linEq.b);
494template<
class SparseMaModelType>
495void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::performMSStep(Environment
const& env, SubModel& MS, SubModel
const& PS,
497 std::vector<ValueType>
const& weightVector)
const {
498 MS.toMS.multiplyWithVector(MS.weightedSolutionVector, MS.auxChoiceValues);
500 MS.toPS.multiplyWithVector(PS.weightedSolutionVector, MS.auxChoiceValues);
504 MS.objectiveSolutionVectors[*consideredObjectives.
begin()] = MS.weightedSolutionVector;
509 for (
auto objIndex : consideredObjectives) {
510 MS.toMS.multiplyWithVector(MS.objectiveSolutionVectors[objIndex], MS.auxChoiceValues);
512 MS.toPS.multiplyWithVector(PS.objectiveSolutionVectors[objIndex], MS.auxChoiceValues);
518template class StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>;
519template double StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::getDigitizationConstant<double>(
520 std::vector<double>
const& direction)
const;
521template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::digitize<double>(
523template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::digitizeTimeBounds<double>(
525template std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::LinEqSolverData>
526StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::initLinEqSolver<double>(
528#ifdef STORM_HAVE_CARL
529template class StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>;
530template storm::RationalNumber StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::getDigitizationConstant<
531 storm::RationalNumber>(std::vector<storm::RationalNumber>
const& direction)
const;
532template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::digitize<storm::RationalNumber>(
534 storm::RationalNumber
const& digitizationConstant)
const;
535template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::digitizeTimeBounds<storm::RationalNumber>(
537 storm::RationalNumber
const& digitizationConstant);
538template std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::LinEqSolverData>
539StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::initLinEqSolver<storm::RationalNumber>(
Helper class for model checking queries that depend on the long run behavior of the (nondeterministic...
Helper Class that takes preprocessed Pcaa data and a weight vector and ...
StandardMaPcaaWeightVectorChecker(preprocessing::SparseMultiObjectivePreprocessorResult< SparseMaModelType > const &preprocessorResult)
virtual void initializeModelTypeSpecificData(SparseMaModelType const &model) override
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createNondetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const override
virtual storm::modelchecker::helper::SparseNondeterministicInfiniteHorizonHelper< ValueType > createDetInfiniteHorizonHelper(storm::storage::SparseMatrix< ValueType > const &transitions) const override
Helper Class that takes preprocessed Pcaa data and a weight vector and ...
void initialize(preprocessing::SparseMultiObjectivePreprocessorResult< SparseMaModelType > const &preprocessorResult)
This class represents a Markov automaton.
virtual std::unique_ptr< MinMaxLinearEquationSolver< ValueType, SolutionType > > create(Environment const &env) const override
A bit vector that is internally represented as a vector of 64-bit values.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
uint_fast64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
bool get(uint_fast64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
A class that holds a possibly non-square matrix in the compressed row storage format.
void convertToEquationSystem()
Transforms the matrix into an equation system.
SparseMatrix selectRowsFromRowGroups(std::vector< index_type > const &rowGroupToRowIndexMapping, bool insertDiagonalEntries=true) const
Selects exactly one row from each row group of this matrix and returns the resulting matrix.
index_type getRowGroupCount() const
Returns the number of row groups in the matrix.
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
#define STORM_PRINT_AND_LOG(message)
SettingsType const & getModule()
Get module.
bool constexpr maximize(OptimizationDirection d)
bool constexpr minimize(OptimizationDirection d)
bool hasCycle(storm::storage::SparseMatrix< T > const &transitionMatrix, boost::optional< storm::storage::BitVector > const &subsystem)
Returns true if the graph represented by the given matrix has a cycle.
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
void addVectors(std::vector< InValueType1 > const &firstOperand, std::vector< InValueType2 > const &secondOperand, std::vector< OutValueType > &target)
Adds the two given vectors and writes the result to the target vector.
T dotProduct(std::vector< T > const &firstOperand, std::vector< T > const &secondOperand)
Computes the dot product (aka scalar product) and returns the result.
VT max_if(std::vector< VT > const &values, storm::storage::BitVector const &filter)
Computes the maximum of the entries from the values that are selected by the (non-empty) filter.
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...
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 isOne(ValueType const &a)
bool isZero(ValueType const &a)
ValueType pow(ValueType const &value, int_fast64_t exponent)
ValueType sqrt(ValueType const &number)