Browse Source

cleaned up GameVi and LraViHelper

main
Stefan Pranger 4 years ago
parent
commit
29fb202761
  1. 11
      src/storm/modelchecker/helper/infinitehorizon/internal/LraViHelper.cpp
  2. 24
      src/storm/modelchecker/rpatl/helper/internal/GameViHelper.cpp

11
src/storm/modelchecker/helper/infinitehorizon/internal/LraViHelper.cpp

@ -221,13 +221,10 @@ namespace storm {
} }
performIterationStep(env, dir, choices); performIterationStep(env, dir, choices);
} }
//std::cout << "result (" << iter << " steps):" << std::endl; if(gameNondetTs()) {
storm::utility::vector::applyPointwise<ValueType, ValueType>(xNew(), xNew(), [&iter] (ValueType const& x_i) -> ValueType { return x_i / (double)iter; }); storm::utility::vector::applyPointwise<ValueType, ValueType>(xNew(), xNew(), [&iter] (ValueType const& x_i) -> ValueType { return x_i / (double)iter; });
//for(int i = 0; i < xNew().size() ; i++ ) { result = (xOld().at(0) * _uniformizationRate)/(double)iter; // TODO is "init" always going to be .at(0) ?
// std::cout << std::setprecision(4) << i << "\t: " << xNew().at(i) << "\t" << xNew().at(i) * _uniformizationRate << "\t" << std::setprecision(16) << xOld().at(i) *_uniformizationRate << std::endl; }
// //if(i == 50) {std::cout << "only showing top 50 lines"; break; }
//}
if(gameNondetTs()) result = (xOld().at(0) * _uniformizationRate)/(double)iter; // TODO is "init" always going to be .at(0) ?
return result; return result;
} }

24
src/storm/modelchecker/rpatl/helper/internal/GameViHelper.cpp

@ -8,8 +8,6 @@
#include "storm/utility/SignalHandler.h" #include "storm/utility/SignalHandler.h"
#include "storm/utility/vector.h" #include "storm/utility/vector.h"
// TODO this will undergo major refactoring as soon as we implement model checking of further properties
namespace storm { namespace storm {
namespace modelchecker { namespace modelchecker {
namespace helper { namespace helper {
@ -21,10 +19,6 @@ namespace storm {
template <typename ValueType> template <typename ValueType>
void GameViHelper<ValueType>::prepareSolversAndMultipliers(const Environment& env) { void GameViHelper<ValueType>::prepareSolversAndMultipliers(const Environment& env) {
// TODO we get whole transitionmatrix and psistates DONE IN smgrpatlhelper
// -> clip statesofcoalition
// -> compute b vector from psiStates
// -> clip transitionmatrix and create multiplier
_multiplier = storm::solver::MultiplierFactory<ValueType>().create(env, _transitionMatrix); _multiplier = storm::solver::MultiplierFactory<ValueType>().create(env, _transitionMatrix);
_x1IsCurrent = false; _x1IsCurrent = false;
@ -75,29 +69,16 @@ namespace storm {
} }
_x1IsCurrent = !_x1IsCurrent; _x1IsCurrent = !_x1IsCurrent;
// multiplyandreducegaussseidel
// Ax + b
if (choices == nullptr) { if (choices == nullptr) {
//STORM_LOG_DEBUG("\n" << _transitionMatrix);
//STORM_LOG_DEBUG("xOld = " << storm::utility::vector::toString(xOld()));
//STORM_LOG_DEBUG("b = " << storm::utility::vector::toString(_b));
//STORM_LOG_DEBUG("xNew = " << storm::utility::vector::toString(xNew()));
_multiplier->multiplyAndReduce(env, dir, xOld(), &_b, xNew(), nullptr, &_statesOfCoalition); _multiplier->multiplyAndReduce(env, dir, xOld(), &_b, xNew(), nullptr, &_statesOfCoalition);
//std::cin.get();
} else { } else {
// Also keep track of the choices made.
_multiplier->multiplyAndReduce(env, dir, xOld(), &_b, xNew(), choices, &_statesOfCoalition); _multiplier->multiplyAndReduce(env, dir, xOld(), &_b, xNew(), choices, &_statesOfCoalition);
} }
// compare applyPointwise // compare applyPointwise
storm::utility::vector::applyPointwise<ValueType, ValueType, ValueType>(xOld(), xNew(), xNew(), [&dir] (ValueType const& a, ValueType const& b) -> ValueType { storm::utility::vector::applyPointwise<ValueType, ValueType, ValueType>(xOld(), xNew(), xNew(), [&dir] (ValueType const& a, ValueType const& b) -> ValueType {
if(storm::solver::maximize(dir)) { if(a > b) return a;
if(a > b) return a; else return b;
else return b;
} else {
if(a > b) return a;
else return b;
}
}); });
} }
@ -129,7 +110,6 @@ namespace storm {
return false; return false;
} }
} }
// TODO needs checking
return true; return true;
} }

|||||||
100:0
Loading…
Cancel
Save