29 std::vector<ValueType>
const& b)
const {
30 STORM_LOG_ASSERT(x.size() == this->A->getRowGroupCount(),
"Provided x-vector has invalid size.");
31 STORM_LOG_ASSERT(b.size() == this->A->getRowCount(),
"Provided b-vector has invalid size.");
36 if (!rowGroupOrdering) {
44 auxiliaryRowVector = std::vector<ValueType>(this->A->getRowCount());
45 auxiliaryRowGroupVector = std::vector<ValueType>(this->A->getRowGroupCount());
48 std::vector<ValueType>* xPtr = &x;
49 std::vector<ValueType>
const* bPtr = &b;
50 if (rowGroupOrdering) {
51 STORM_LOG_ASSERT(rowGroupOrdering->size() == x.size(),
"x-vector has unexpected size.");
52 STORM_LOG_ASSERT(auxiliaryRowGroupVector->size() == x.size(),
"x-vector has unexpected size.");
53 STORM_LOG_ASSERT(auxiliaryRowVector->size() == b.size(),
"b-vector has unexpected size.");
54 for (uint64_t newGroupIndex = 0; newGroupIndex < x.size(); ++newGroupIndex) {
55 uint64_t newRow = orderedMatrix->getRowGroupIndices()[newGroupIndex];
56 uint64_t newRowGroupEnd = orderedMatrix->getRowGroupIndices()[newGroupIndex + 1];
57 uint64_t oldRow = this->A->getRowGroupIndices()[(*rowGroupOrdering)[newGroupIndex]];
58 for (; newRow < newRowGroupEnd; ++newRow, ++oldRow) {
59 (*auxiliaryRowVector)[newRow] = b[oldRow];
62 for (
auto const& bFactor : bFactors) {
63 (*auxiliaryRowVector)[bFactor.first] *= bFactor.second;
65 xPtr = &auxiliaryRowGroupVector.get();
66 bPtr = &auxiliaryRowVector.get();
70 std::vector<uint64_t>* choicesPtr =
nullptr;
71 if (this->isTrackSchedulerSet()) {
72 if (this->schedulerChoices) {
73 this->schedulerChoices->resize(this->A->getRowGroupCount());
75 this->schedulerChoices = std::vector<uint64_t>(this->A->getRowGroupCount());
77 if (rowGroupOrdering) {
78 if (auxiliaryRowGroupIndexVector) {
79 auxiliaryRowGroupIndexVector->resize(this->A->getRowGroupCount());
81 auxiliaryRowGroupIndexVector = std::vector<uint64_t>(this->A->getRowGroupCount());
83 choicesPtr = &(auxiliaryRowGroupIndexVector.get());
85 choicesPtr = &(this->schedulerChoices.get());
90 this->multiplier->multiplyAndReduceGaussSeidel(env, dir, *xPtr, bPtr, choicesPtr,
true);
92 if (rowGroupOrdering) {
94 for (uint64_t newGroupIndex = 0; newGroupIndex < x.size(); ++newGroupIndex) {
95 x[(*rowGroupOrdering)[newGroupIndex]] = (*xPtr)[newGroupIndex];
97 if (this->isTrackSchedulerSet()) {
99 for (uint64_t newGroupIndex = 0; newGroupIndex < x.size(); ++newGroupIndex) {
100 this->schedulerChoices.get()[(*rowGroupOrdering)[newGroupIndex]] = (*choicesPtr)[newGroupIndex];
105 if (!this->isCachingEnabled()) {
virtual MinMaxLinearEquationSolverRequirements getRequirements(Environment const &env, boost::optional< storm::solver::OptimizationDirection > const &direction=boost::none, bool const &hasInitialScheduler=false) const override
Retrieves the requirements of this solver for solving equations with the current settings.
storm::storage::SparseMatrix< ValueType > createReorderedMatrix(storm::storage::SparseMatrix< ValueType > const &matrix, std::vector< uint64_t > const &newToOrigIndexMap, std::vector< std::pair< uint64_t, ValueType > > &bFactors)
reorders the row group such that the i'th row of the new matrix corresponds to the order[i]'th row of...