Browse Source

obtain scheduler from value iteration

Former-commit-id: ef976fbd6e
tempestpy_adaptions
sjunges 9 years ago
parent
commit
434f1a4903
  1. 14
      src/solver/StandardMinMaxLinearEquationSolver.cpp

14
src/solver/StandardMinMaxLinearEquationSolver.cpp

@ -235,16 +235,30 @@ namespace storm {
reportStatus(status, iterations); reportStatus(status, iterations);
// If we performed an odd number of iterations, we need to swap the x and currentX, because the newest result // If we performed an odd number of iterations, we need to swap the x and currentX, because the newest result
// is currently stored in currentX, but x is the output vector. // is currently stored in currentX, but x is the output vector.
if (currentX == auxiliarySolvingVectorMemory.get()) { if (currentX == auxiliarySolvingVectorMemory.get()) {
std::swap(x, *currentX); std::swap(x, *currentX);
} }
// If requested, we store the scheduler for retrieval.
if (this->isTrackSchedulerSet()) {
if(iterations==0){ //may happen due to custom termination condition. Then we need to compute x'= A*x+b
solver->multiply(x, &b, *auxiliarySolvingMultiplyMemory);
}
std::vector<storm::storage::sparse::state_type> choices(this->A.getRowGroupCount());
// Reduce the multiplyResult and keep track of the choices made
storm::utility::vector::reduceVectorMinOrMax(dir, *auxiliarySolvingMultiplyMemory, x, this->A.getRowGroupIndices(), &choices);
this->scheduler = std::make_unique<storm::storage::TotalScheduler>(std::move(choices));
}
// If we allocated auxiliary memory, we need to dispose of it now. // If we allocated auxiliary memory, we need to dispose of it now.
if (allocatedAuxMemory) { if (allocatedAuxMemory) {
this->deallocateAuxMemory(MinMaxLinearEquationSolverOperation::SolveEquations); this->deallocateAuxMemory(MinMaxLinearEquationSolverOperation::SolveEquations);
} }
if(status == Status::Converged || status == Status::TerminatedEarly) { if(status == Status::Converged || status == Status::TerminatedEarly) {
return true; return true;

Loading…
Cancel
Save