From b90e88c365e794e0505105e2e32fd53d468514c7 Mon Sep 17 00:00:00 2001 From: Timo Philipp Gros Date: Fri, 24 Nov 2017 12:48:14 +0100 Subject: [PATCH] first version, seems to be working, need to check more --- .../helper/SparseMarkovAutomatonCslHelper.cpp | 104 +++++++++--------- 1 file changed, 50 insertions(+), 54 deletions(-) diff --git a/src/storm/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp b/src/storm/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp index 3ef29e743..c84e48477 100644 --- a/src/storm/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp +++ b/src/storm/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.cpp @@ -231,6 +231,11 @@ namespace storm { template ::SupportsExponential, int>::type> void SparseMarkovAutomatonCslHelper::calculateWu(std::vector> const& relativeReachability, OptimizationDirection dir, uint64_t k, uint64_t node, ValueType lambda, std::vector>& wu, storm::storage::SparseMatrix const& fullTransitionMatrix, storm::storage::BitVector const& markovianStates, storm::storage::BitVector const& psiStates, storm::solver::MinMaxLinearEquationSolverFactory const& minMaxLinearEquationSolverFactory){ if (wu[k][node]!=-1){return;} //dynamic programming. avoiding multiple calculation. + + std::ofstream logfile("U+logfile.txt", std::ios::app); + + auto probabilisticStates = ~markovianStates; + uint64_t N = wu.size()-1; auto const& rowGroupIndices = fullTransitionMatrix.getRowGroupIndices( ); @@ -255,46 +260,42 @@ namespace storm { } res+=element.getValue()*wu[k+1][to]; } + wu[k][node]=res; } else { - // applying simpleMDP stuff auto numberOfStates=relativeReachability[0].size(); typename storm::storage::SparseMatrix probMatrix = fullTransitionMatrix.getSubmatrix(true, ~markovianStates , ~markovianStates, true); auto probSize = probMatrix.getRowGroupCount(); - std::vector b(probSize, 0), x(probSize,0); + std::vector b(probMatrix.getRowCount(), 0), x(probSize,0); //calculate b - for (uint64_t i =0 ; i::SupportsExponential, int>::type> @@ -352,6 +352,8 @@ namespace storm { std::ofstream logfile("U+logfile.txt", std::ios::app); + auto probabilisticStates = ~markovianStates; + if (vd[k][node]!=-1){return;} //dynamic programming. avoiding multiple calculation. logfile << "calculating vd for k = " << k << " node "<< node << " \t"; uint64_t N = vd.size()-1; @@ -397,41 +399,35 @@ namespace storm { auto numberOfStates=relativeReachability[0].size(); typename storm::storage::SparseMatrix probMatrix = fullTransitionMatrix.getSubmatrix(true, ~markovianStates , ~markovianStates, true); auto probSize = probMatrix.getRowGroupCount(); - std::vector b(probSize, 0), x(probSize,0); + std::vector b(probMatrix.getRowCount(), 0), x(probSize,0); //calculate b - for (uint64_t i =0 ; isolveEquations(dir, x, b); - logfile << "goal vector x is \n"; - for (int i =0 ; i