Browse Source

added constrainedChoiceValues for boundedGloballyFormulas

tempestpy_adaptions
Lukas Posch 4 years ago
parent
commit
027ed523cd
  1. 14
      src/storm/modelchecker/rpatl/helper/SparseSmgRpatlHelper.cpp
  2. 7
      src/storm/modelchecker/rpatl/helper/internal/BoundedGloballyGameViHelper.cpp
  3. 2
      src/storm/modelchecker/rpatl/helper/internal/BoundedGloballyGameViHelper.h

14
src/storm/modelchecker/rpatl/helper/SparseSmgRpatlHelper.cpp

@ -120,6 +120,8 @@ namespace storm {
// Reduce the matrix to relevant states // Reduce the matrix to relevant states
storm::storage::SparseMatrix<ValueType> submatrix = transitionMatrix.getSubmatrix(true, relevantStates, relevantStates, false); storm::storage::SparseMatrix<ValueType> submatrix = transitionMatrix.getSubmatrix(true, relevantStates, relevantStates, false);
std::vector<ValueType> constrainedChoiceValues = std::vector<ValueType>(submatrix.getRowCount(), storm::utility::zero<ValueType>());
storm::storage::BitVector clippedStatesOfCoalition(relevantStates.getNumberOfSetBits()); storm::storage::BitVector clippedStatesOfCoalition(relevantStates.getNumberOfSetBits());
clippedStatesOfCoalition.setClippedStatesOfCoalition(relevantStates, statesOfCoalition); clippedStatesOfCoalition.setClippedStatesOfCoalition(relevantStates, statesOfCoalition);
clippedStatesOfCoalition.complement(); clippedStatesOfCoalition.complement();
@ -134,17 +136,15 @@ namespace storm {
// in case of upperBound = 0 the states which are initially "safe" are filled with ones // in case of upperBound = 0 the states which are initially "safe" are filled with ones
if(upperBound > 0) if(upperBound > 0)
{ {
viHelper.performValueIteration(env, x, goal.direction(), upperBound);
viHelper.performValueIteration(env, x, goal.direction(), upperBound, constrainedChoiceValues);
/* if (produceScheduler) {
scheduler = std::make_unique<storm::storage::Scheduler<ValueType>>(expandScheduler(viHelper.extractScheduler(), relevantStates, ~relevantStates));
}*/
} }
viHelper.fillResultVector(x, relevantStates); viHelper.fillResultVector(x, relevantStates);
// TODO: i am not sure about that ~psiStates are correct - but I think (~psiStates are unsafe like the ~phiStates before)
// maybe I should create another method for this case
if (produceScheduler) {
scheduler = std::make_unique<storm::storage::Scheduler<ValueType>>(expandScheduler(viHelper.extractScheduler(), relevantStates, ~relevantStates));
}
STORM_LOG_DEBUG("x = " << x); STORM_LOG_DEBUG("x = " << x);
return MDPSparseModelCheckingHelperReturnType<ValueType>(std::move(x), std::move(scheduler)); return MDPSparseModelCheckingHelperReturnType<ValueType>(std::move(x), std::move(scheduler));

7
src/storm/modelchecker/rpatl/helper/internal/BoundedGloballyGameViHelper.cpp

@ -22,7 +22,7 @@ namespace storm {
} }
template <typename ValueType> template <typename ValueType>
void BoundedGloballyGameViHelper<ValueType>::performValueIteration(Environment const& env, std::vector<ValueType>& x, storm::solver::OptimizationDirection const dir, uint64_t upperBound) {
void BoundedGloballyGameViHelper<ValueType>::performValueIteration(Environment const& env, std::vector<ValueType>& x, storm::solver::OptimizationDirection const dir, uint64_t upperBound, std::vector<ValueType>& constrainedChoiceValues) {
prepareSolversAndMultipliers(env); prepareSolversAndMultipliers(env);
_x = x; _x = x;
@ -34,6 +34,9 @@ namespace storm {
} }
for (uint64_t iter = 0; iter < upperBound; iter++) { for (uint64_t iter = 0; iter < upperBound; iter++) {
if(iter == upperBound - 1) {
_multiplier->multiply(env, _x, nullptr, constrainedChoiceValues);
}
performIterationStep(env, dir); performIterationStep(env, dir);
} }
@ -47,7 +50,7 @@ namespace storm {
} }
// multiplyandreducegaussseidel // multiplyandreducegaussseidel
// Ax + b
// Ax = x'
if (choices == nullptr) { if (choices == nullptr) {
_multiplier->multiplyAndReduce(env, dir, _x, nullptr, _x, nullptr, &_statesOfCoalition); _multiplier->multiplyAndReduce(env, dir, _x, nullptr, _x, nullptr, &_statesOfCoalition);
} else { } else {

2
src/storm/modelchecker/rpatl/helper/internal/BoundedGloballyGameViHelper.h

@ -23,7 +23,7 @@ namespace storm {
void prepareSolversAndMultipliers(const Environment& env); void prepareSolversAndMultipliers(const Environment& env);
void performValueIteration(Environment const& env, std::vector<ValueType>& x, storm::solver::OptimizationDirection const dir, uint64_t upperBound);
void performValueIteration(Environment const& env, std::vector<ValueType>& x, storm::solver::OptimizationDirection const dir, uint64_t upperBound, std::vector<ValueType>& constrainedChoiceValues);
/*! /*!
* Fills the result vector to the original size with ones for being psiStates, zeros for being not phiStates * Fills the result vector to the original size with ones for being psiStates, zeros for being not phiStates

Loading…
Cancel
Save