From 434f1a4903ccb6e7200fd5a418f5bca18e7991bb Mon Sep 17 00:00:00 2001 From: sjunges Date: Mon, 8 Aug 2016 20:56:01 +0200 Subject: [PATCH] obtain scheduler from value iteration Former-commit-id: ef976fbd6e9f7d2e34a6f341dd4cb087c6cab0f2 --- src/solver/StandardMinMaxLinearEquationSolver.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/solver/StandardMinMaxLinearEquationSolver.cpp b/src/solver/StandardMinMaxLinearEquationSolver.cpp index 8c4f01108..6e0313cf9 100644 --- a/src/solver/StandardMinMaxLinearEquationSolver.cpp +++ b/src/solver/StandardMinMaxLinearEquationSolver.cpp @@ -235,16 +235,30 @@ namespace storm { reportStatus(status, iterations); + // 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. if (currentX == auxiliarySolvingVectorMemory.get()) { 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 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(std::move(choices)); + } // If we allocated auxiliary memory, we need to dispose of it now. if (allocatedAuxMemory) { this->deallocateAuxMemory(MinMaxLinearEquationSolverOperation::SolveEquations); } + + + if(status == Status::Converged || status == Status::TerminatedEarly) { return true;