21namespace modelchecker {
22namespace multiobjective {
24template<
class SparseMaModelType>
31template<
class SparseMaModelType>
33 markovianStates = model.getMarkovianStates();
34 exitRates = model.getExitRates();
37 this->actionRewards.assign(this->objectives.size(), {});
38 this->stateRewards.assign(this->objectives.size(), {});
39 for (uint64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
40 auto const& formula = *this->objectives[objIndex].formula;
41 STORM_LOG_THROW(formula.isRewardOperatorFormula() && formula.asRewardOperatorFormula().hasRewardModelName(), storm::exceptions::UnexpectedException,
42 "Unexpected type of operator formula: " << formula);
43 typename SparseMaModelType::RewardModelType
const& rewModel = model.getRewardModel(formula.asRewardOperatorFormula().getRewardModelName());
44 STORM_LOG_ASSERT(!rewModel.hasTransitionRewards(),
"Preprocessed Reward model has transition rewards which is not expected.");
45 this->actionRewards[objIndex] = rewModel.hasStateActionRewards()
46 ? rewModel.getStateActionRewardVector()
47 : std::vector<ValueType>(model.getTransitionMatrix().getRowCount(), storm::utility::zero<ValueType>());
48 if (formula.getSubformula().isTotalRewardFormula()) {
49 if (rewModel.hasStateRewards()) {
51 for (
auto markovianState : markovianStates) {
52 this->actionRewards[objIndex][model.getTransitionMatrix().getRowGroupIndices()[markovianState]] +=
53 rewModel.getStateReward(markovianState) / exitRates[markovianState];
56 }
else if (formula.getSubformula().isLongRunAverageRewardFormula()) {
58 if (rewModel.hasStateRewards()) {
59 this->stateRewards[objIndex] = rewModel.getStateRewardVector();
63 formula.getSubformula().asCumulativeRewardFormula().getTimeBoundReference().isTimeBound(),
64 storm::exceptions::UnexpectedException,
"Unexpected type of sub-formula: " << formula.getSubformula());
65 STORM_LOG_THROW(!rewModel.hasStateRewards(), storm::exceptions::InvalidPropertyException,
66 "Found state rewards for time bounded objective " << this->objectives[objIndex].originalFormula <<
". This is not supported.");
68 this->objectives[objIndex].originalFormula->isProbabilityOperatorFormula() &&
69 this->objectives[objIndex].originalFormula->asProbabilityOperatorFormula().getSubformula().isBoundedUntilFormula(),
70 "Objective " << this->objectives[objIndex].originalFormula
71 <<
" was simplified to a cumulative reward formula. Correctness of the algorithm is unknown for this type of property.");
75 if (storm::settings::getModule<storm::settings::modules::CoreSettings>().isShowStatisticsSet()) {
76 STORM_PRINT_AND_LOG(
"Final preprocessed model has " << markovianStates.getNumberOfSetBits() <<
" Markovian states.\n");
80template<
class SparseMdpModelType>
87template<
class SparseMdpModelType>
93 result.setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
97template<
class SparseMaModelType>
99 std::vector<ValueType>& weightedRewardVector) {
101 SubModel MS = createSubModel(
true, weightedRewardVector);
102 SubModel PS = createSubModel(
false, weightedRewardVector);
105 ValueType digitizationConstant = getDigitizationConstant(weightVector);
106 digitize(MS, digitizationConstant);
109 TimeBoundMap upperTimeBounds;
110 digitizeTimeBounds(upperTimeBounds, digitizationConstant);
117 std::unique_ptr<MinMaxSolverData> minMax = initMinMaxSolver(env, PS, acyclic, weightVector);
121 std::unique_ptr<LinEqSolverData> linEq = initLinEqSolver(env, PS, acyclic);
124 std::vector<uint_fast64_t> optimalChoicesAtCurrentEpoch(PS.getNumberOfStates(), std::numeric_limits<uint_fast64_t>::max());
129 auto upperTimeBoundIt = upperTimeBounds.
begin();
130 uint_fast64_t currentEpoch = upperTimeBounds.empty() ? 0 : upperTimeBoundIt->first;
133 updateDataToCurrentEpoch(MS, PS, *minMax, consideredObjectives, currentEpoch, weightVector, upperTimeBoundIt, upperTimeBounds);
136 performPSStep(env, PS, MS, *minMax, *linEq, optimalChoicesAtCurrentEpoch, consideredObjectives, weightVector);
140 if (currentEpoch > 0) {
141 performMSStep(env, MS, PS, consideredObjectives, weightVector);
152 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
158template<
class SparseMaModelType>
159typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::SubModel StandardMaPcaaWeightVectorChecker<SparseMaModelType>::createSubModel(
160 bool createMS, std::vector<ValueType>
const& weightedRewardVector)
const {
164 result.states = createMS ? markovianStates : probabilisticStates;
165 result.choices = this->transitionMatrix.getRowFilter(result.states);
166 STORM_LOG_ASSERT(!createMS || result.states.getNumberOfSetBits() == result.choices.getNumberOfSetBits(),
167 "row groups for Markovian states should consist of exactly one row");
170 result.toMS = this->transitionMatrix.getSubmatrix(
true, result.states, markovianStates, createMS);
171 result.toPS = this->transitionMatrix.getSubmatrix(
true, result.states, probabilisticStates,
false);
172 STORM_LOG_ASSERT(result.getNumberOfStates() == result.states.getNumberOfSetBits() && result.getNumberOfStates() == result.toMS.getRowGroupCount() &&
173 result.getNumberOfStates() == result.toPS.getRowGroupCount(),
174 "Invalid state count for subsystem");
175 STORM_LOG_ASSERT(result.getNumberOfChoices() == result.choices.getNumberOfSetBits() && result.getNumberOfChoices() == result.toMS.getRowCount() &&
176 result.getNumberOfChoices() == result.toPS.getRowCount(),
177 "Invalid choice count for subsystem");
179 result.weightedRewardVector.resize(result.getNumberOfChoices());
181 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
182 std::vector<ValueType>
const& objRewards = this->actionRewards[objIndex];
183 std::vector<ValueType> subModelObjRewards;
184 subModelObjRewards.reserve(result.getNumberOfChoices());
185 for (
auto choice : result.choices) {
186 subModelObjRewards.push_back(objRewards[choice]);
188 result.objectiveRewardVectors.push_back(std::move(subModelObjRewards));
191 result.weightedSolutionVector.resize(result.getNumberOfStates());
193 result.objectiveSolutionVectors.resize(this->objectives.size());
194 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
195 result.objectiveSolutionVectors[objIndex].resize(result.weightedSolutionVector.size());
199 result.auxChoiceValues.resize(result.getNumberOfChoices());
204template<
class SparseMaModelType>
205template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
206VT StandardMaPcaaWeightVectorChecker<SparseMaModelType>::getDigitizationConstant(std::vector<ValueType>
const& weightVector)
const {
219 std::vector<VT> timeBounds;
220 std::vector<VT> eToPowerOfMinusMaxRateTimesBound;
221 VT smallestNonZeroBound = storm::utility::zero<VT>();
222 for (
auto const& obj : this->objectives) {
223 if (obj.formula->getSubformula().isCumulativeRewardFormula()) {
224 timeBounds.push_back(obj.formula->getSubformula().asCumulativeRewardFormula().template getBound<VT>());
226 "Got zero-valued upper time bound. This is not suppoted.");
227 eToPowerOfMinusMaxRateTimesBound.push_back(std::exp(-maxRate * timeBounds.back()));
228 smallestNonZeroBound =
storm::utility::isZero(smallestNonZeroBound) ? timeBounds.back() : std::min(smallestNonZeroBound, timeBounds.back());
230 timeBounds.push_back(storm::utility::zero<VT>());
231 eToPowerOfMinusMaxRateTimesBound.push_back(storm::utility::zero<VT>());
236 return storm::utility::one<VT>();
244 uint_fast64_t smallestStepBound = 1;
245 VT delta = smallestNonZeroBound / smallestStepBound;
247 bool deltaValid =
true;
248 for (
auto objIndex : objectivesWithTimeBound) {
249 auto const& timeBound = timeBounds[objIndex];
250 if (timeBound / delta != std::floor(timeBound / delta)) {
256 VT weightedPrecisionForCurrentDelta = storm::utility::zero<VT>();
257 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
258 VT precisionOfObj = storm::utility::zero<VT>();
259 if (objectivesWithTimeBound.
get(objIndex)) {
261 storm::utility::one<VT>() - (eToPowerOfMinusMaxRateTimesBound[objIndex] *
262 storm::utility::pow(storm::utility::one<VT>() + maxRate * delta, timeBounds[objIndex] / delta));
264 weightedPrecisionForCurrentDelta += weightVector[objIndex] * precisionOfObj;
266 deltaValid &= weightedPrecisionForCurrentDelta <= goalPrecisionTimesNorm;
272 STORM_LOG_ASSERT(delta > smallestNonZeroBound / smallestStepBound,
"Digitization constant is expected to become smaller in every iteration");
273 delta = smallestNonZeroBound / smallestStepBound;
275 STORM_LOG_DEBUG(
"Found digitization constant: " << delta <<
". At least " << smallestStepBound <<
" digitization steps will be necessarry");
279template<
class SparseMaModelType>
280template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
281VT StandardMaPcaaWeightVectorChecker<SparseMaModelType>::getDigitizationConstant(std::vector<ValueType>
const& )
const {
282 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
285template<
class SparseMaModelType>
286template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
287void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitize(SubModel& MS, VT
const& digitizationConstant)
const {
288 std::vector<VT> rateVector(MS.getNumberOfChoices());
290 for (uint_fast64_t row = 0; row < rateVector.size(); ++row) {
291 VT
const eToMinusRateTimesDelta = std::exp(-rateVector[row] * digitizationConstant);
292 for (
auto& entry : MS.toMS.getRow(row)) {
293 entry.setValue((storm::utility::one<VT>() - eToMinusRateTimesDelta) * entry.getValue());
294 if (entry.getColumn() == row) {
295 entry.setValue(entry.getValue() + eToMinusRateTimesDelta);
298 for (
auto& entry : MS.toPS.getRow(row)) {
299 entry.setValue((storm::utility::one<VT>() - eToMinusRateTimesDelta) * entry.getValue());
301 MS.weightedRewardVector[row] *= storm::utility::one<VT>() - eToMinusRateTimesDelta;
302 for (
auto& objVector : MS.objectiveRewardVectors) {
303 objVector[row] *= storm::utility::one<VT>() - eToMinusRateTimesDelta;
308template<
class SparseMaModelType>
309template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
310void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitize(SubModel& , VT
const& )
const {
311 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
314template<
class SparseMaModelType>
315template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
316void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitizeTimeBounds(TimeBoundMap& upperTimeBounds, VT
const& digitizationConstant) {
318 for (uint_fast64_t objIndex = 0; objIndex < this->objectives.size(); ++objIndex) {
319 auto const& obj = this->objectives[objIndex];
320 VT errorTowardsZero = storm::utility::zero<VT>();
321 VT errorAwayFromZero = storm::utility::zero<VT>();
322 if (obj.formula->getSubformula().isCumulativeRewardFormula()) {
323 VT timeBound = obj.formula->getSubformula().asCumulativeRewardFormula().template getBound<VT>();
324 uint_fast64_t digitizedBound = storm::utility::convertNumber<uint_fast64_t>(timeBound / digitizationConstant);
325 auto timeBoundIt = upperTimeBounds.insert(std::make_pair(digitizedBound,
storm::storage::BitVector(this->objectives.size(),
false))).first;
326 timeBoundIt->second.set(objIndex);
327 VT digitizationError = storm::utility::one<VT>();
329 std::exp(-maxRate * timeBound) *
storm::utility::pow(storm::utility::one<VT>() + maxRate * digitizationConstant, digitizedBound);
330 errorAwayFromZero += digitizationError;
333 this->offsetsToUnderApproximation[objIndex] = -errorTowardsZero;
334 this->offsetsToOverApproximation[objIndex] = errorAwayFromZero;
336 this->offsetsToUnderApproximation[objIndex] = errorAwayFromZero;
337 this->offsetsToOverApproximation[objIndex] = -errorTowardsZero;
342template<
class SparseMaModelType>
343template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
344void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::digitizeTimeBounds(TimeBoundMap& , VT
const& ) {
345 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
348template<
class SparseMaModelType>
349std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::MinMaxSolverData>
350StandardMaPcaaWeightVectorChecker<SparseMaModelType>::initMinMaxSolver(Environment
const& env, SubModel
const& PS,
bool acyclic,
351 std::vector<ValueType>
const& weightVector)
const {
352 std::unique_ptr<MinMaxSolverData> result(
new MinMaxSolverData());
353 result->env = std::make_unique<storm::Environment>(env);
356 result->env->solver().minMax().setMethod(storm::solver::MinMaxMethod::Acyclic);
359 result->solver = minMaxSolverFactory.
create(*result->env, PS.toPS);
360 result->solver->setHasUniqueSolution(
true);
361 result->solver->setHasNoEndComponents(
true);
362 result->solver->setTrackScheduler(
true);
363 result->solver->setCachingEnabled(
true);
364 auto req = result->solver->getRequirements(*result->env, storm::solver::OptimizationDirection::Maximize,
false);
365 boost::optional<ValueType> lowerBound = this->computeWeightedResultBound(
true, weightVector,
storm::storage::BitVector(weightVector.size(),
true));
367 result->solver->setLowerBound(lowerBound.get());
368 req.clearLowerBounds();
370 boost::optional<ValueType> upperBound = this->computeWeightedResultBound(
false, weightVector,
storm::storage::BitVector(weightVector.size(),
true));
372 result->solver->setUpperBound(upperBound.get());
373 req.clearUpperBounds();
378 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
379 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
380 result->solver->setRequirementsChecked(
true);
381 result->solver->setOptimizationDirection(storm::solver::OptimizationDirection::Maximize);
383 result->b.resize(PS.getNumberOfChoices());
388template<
class SparseMaModelType>
389template<typename VT, typename std::enable_if<storm::NumberTraits<VT>::SupportsExponential,
int>::type>
390std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::LinEqSolverData>
392 std::unique_ptr<LinEqSolverData> result(
new LinEqSolverData());
393 result->env = std::make_unique<Environment>(env);
394 result->acyclic = acyclic;
397 result->env->solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Acyclic);
399 result->factory = std::make_unique<storm::solver::GeneralLinearEquationSolverFactory<ValueType>>();
400 result->b.resize(PS.getNumberOfStates());
404template<
class SparseMaModelType>
405template<typename VT, typename std::enable_if<!storm::NumberTraits<VT>::SupportsExponential,
int>::type>
406std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<SparseMaModelType>::LinEqSolverData>
408 STORM_LOG_THROW(
false, storm::exceptions::InvalidOperationException,
"Computing bounded probabilities of MAs is unsupported for this value type.");
411template<
class SparseMaModelType>
412void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::updateDataToCurrentEpoch(
413 SubModel& MS, SubModel& PS, MinMaxSolverData& minMax,
storm::storage::BitVector& consideredObjectives, uint_fast64_t
const& currentEpoch,
414 std::vector<ValueType>
const& weightVector, TimeBoundMap::iterator& upperTimeBoundIt, TimeBoundMap
const& upperTimeBounds) {
415 if (upperTimeBoundIt != upperTimeBounds.end() && currentEpoch == upperTimeBoundIt->first) {
416 consideredObjectives |= upperTimeBoundIt->second;
417 for (
auto objIndex : upperTimeBoundIt->second) {
420 storm::solver::minimize(this->objectives[objIndex].formula->getOptimalityType()) ? -weightVector[objIndex] : weightVector[objIndex];
428 PS.toMS.multiplyWithVector(MS.weightedSolutionVector, minMax.b);
432template<
class SparseMaModelType>
433void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::performPSStep(Environment
const& env, SubModel& PS, SubModel
const& MS, MinMaxSolverData& minMax,
434 LinEqSolverData& linEq, std::vector<uint_fast64_t>& optimalChoicesAtCurrentEpoch,
436 std::vector<ValueType>
const& weightVector)
const {
438 minMax.solver->solveEquations(*minMax.env, PS.weightedSolutionVector, minMax.b);
439 auto const& newChoices = minMax.solver->getSchedulerChoices();
442 optimalChoicesAtCurrentEpoch = newChoices;
443 PS.objectiveSolutionVectors[*consideredObjectives.
begin()] = PS.weightedSolutionVector;
449 if (linEq.solver ==
nullptr || newChoices != optimalChoicesAtCurrentEpoch) {
450 optimalChoicesAtCurrentEpoch = newChoices;
451 linEq.solver =
nullptr;
454 if (needEquationSystem) {
457 linEq.solver = linEq.factory->create(*linEq.env, std::move(linEqMatrix));
458 linEq.solver->setCachingEnabled(
true);
459 auto req = linEq.solver->getRequirements(*linEq.env);
463 STORM_LOG_THROW(!req.hasEnabledCriticalRequirement(), storm::exceptions::UncheckedRequirementException,
464 "Solver requirements " + req.getEnabledRequirementsAsString() +
" not checked.");
470 for (
auto objIndex : consideredObjectives) {
471 auto const& objectiveRewardVectorPS = PS.objectiveRewardVectors[objIndex];
472 auto const& objectiveSolutionVectorMS = MS.objectiveSolutionVectors[objIndex];
475 auto itGroupIndex = PS.toPS.getRowGroupIndices().begin();
476 auto itChoiceOffset = optimalChoicesAtCurrentEpoch.begin();
477 for (
auto& bValue : linEq.b) {
478 uint_fast64_t row = (*itGroupIndex) + (*itChoiceOffset);
479 bValue = objectiveRewardVectorPS[row];
480 for (
auto const& entry : PS.toMS.getRow(row)) {
481 bValue += entry.getValue() * objectiveSolutionVectorMS[entry.getColumn()];
486 linEq.solver->solveEquations(*linEq.env, PS.objectiveSolutionVectors[objIndex], linEq.b);
491template<
class SparseMaModelType>
492void StandardMaPcaaWeightVectorChecker<SparseMaModelType>::performMSStep(Environment
const& env, SubModel& MS, SubModel
const& PS,
494 std::vector<ValueType>
const& weightVector)
const {
495 MS.toMS.multiplyWithVector(MS.weightedSolutionVector, MS.auxChoiceValues);
497 MS.toPS.multiplyWithVector(PS.weightedSolutionVector, MS.auxChoiceValues);
501 MS.objectiveSolutionVectors[*consideredObjectives.
begin()] = MS.weightedSolutionVector;
506 for (
auto objIndex : consideredObjectives) {
507 MS.toMS.multiplyWithVector(MS.objectiveSolutionVectors[objIndex], MS.auxChoiceValues);
509 MS.toPS.multiplyWithVector(PS.objectiveSolutionVectors[objIndex], MS.auxChoiceValues);
515template class StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>;
516template double StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::getDigitizationConstant<double>(
517 std::vector<double>
const& direction)
const;
518template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::digitize<double>(
520template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::digitizeTimeBounds<double>(
522template std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::LinEqSolverData>
523StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<double>>::initLinEqSolver<double>(
526template class StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>;
527template storm::RationalNumber StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::getDigitizationConstant<
528 storm::RationalNumber>(std::vector<storm::RationalNumber>
const& direction)
const;
529template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::digitize<storm::RationalNumber>(
531 storm::RationalNumber
const& digitizationConstant)
const;
532template void StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::digitizeTimeBounds<storm::RationalNumber>(
534 storm::RationalNumber
const& digitizationConstant);
535template std::unique_ptr<typename StandardMaPcaaWeightVectorChecker<storm::models::sparse::MarkovAutomaton<storm::RationalNumber>>::LinEqSolverData>
536StandardMaPcaaWeightVectorChecker<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.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
bool get(uint64_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)
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)