Browse Source

smg lra debug commit

this should be dropped in the future
main
Stefan Pranger 4 years ago
parent
commit
c6c5c5cc13
  1. 1
      src/storm/builder/ExplicitModelBuilder.cpp
  2. 3
      src/storm/modelchecker/helper/infinitehorizon/SparseNondeterministicGameInfiniteHorizonHelper.cpp
  3. 9
      src/storm/modelchecker/helper/infinitehorizon/internal/LraViHelper.cpp
  4. 4
      src/storm/modelchecker/rpatl/SparseSmgRpatlModelChecker.cpp
  5. 15
      src/storm/solver/GmmxxMultiplier.cpp
  6. 6
      src/storm/storage/Decomposition.cpp
  7. 2
      src/storm/storage/MaximalEndComponent.cpp
  8. 5
      src/storm/storage/SparseMatrix.cpp

1
src/storm/builder/ExplicitModelBuilder.cpp

@ -161,6 +161,7 @@ namespace storm {
while (!statesToExplore.empty()) { while (!statesToExplore.empty()) {
// Get the first state in the queue. // Get the first state in the queue.
CompressedState currentState = statesToExplore.front().first; CompressedState currentState = statesToExplore.front().first;
STORM_LOG_DEBUG("Exploring (" << currentRowGroup << ") : " << toString(currentState, this->generator->getVariableInformation()));
StateType currentIndex = statesToExplore.front().second; StateType currentIndex = statesToExplore.front().second;
statesToExplore.pop_front(); statesToExplore.pop_front();

3
src/storm/modelchecker/helper/infinitehorizon/SparseNondeterministicGameInfiniteHorizonHelper.cpp

@ -63,7 +63,10 @@ namespace storm {
this->_backwardTransitions = this->_computedBackwardTransitions.get(); this->_backwardTransitions = this->_computedBackwardTransitions.get();
} }
this->_computedLongRunComponentDecomposition = std::make_unique<storm::storage::GameMaximalEndComponentDecomposition<ValueType>>(this->_transitionMatrix, *this->_backwardTransitions); this->_computedLongRunComponentDecomposition = std::make_unique<storm::storage::GameMaximalEndComponentDecomposition<ValueType>>(this->_transitionMatrix, *this->_backwardTransitions);
this->_longRunComponentDecomposition = this->_computedLongRunComponentDecomposition.get(); this->_longRunComponentDecomposition = this->_computedLongRunComponentDecomposition.get();
//STORM_LOG_DEBUG("\n" << this->_transitionMatrix);
STORM_LOG_DEBUG("GMEC: " << *(this->_longRunComponentDecomposition));
} }
} }

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

@ -141,6 +141,7 @@ namespace storm {
_IsTransitions = isTransitionsBuilder.build(); _IsTransitions = isTransitionsBuilder.build();
_IsToTsTransitions = isToTsTransitionsBuilder.build(); _IsToTsTransitions = isToTsTransitionsBuilder.build();
} }
STORM_LOG_DEBUG(uniformizationFactor << " - " << _uniformizationRate);
} }
template <typename ValueType, typename ComponentType, LraViTransitionsType TransitionsType> template <typename ValueType, typename ComponentType, LraViTransitionsType TransitionsType>
@ -213,6 +214,14 @@ namespace storm {
prepareNextIteration(env); prepareNextIteration(env);
performIterationStep(env, dir, choices); performIterationStep(env, dir, choices);
} }
std::cout << "result (" << iter << " steps):" << std::endl;
for(int i = 0; i < xNew().size() ; i++ ) {
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; }
for(int i = 0; i < xNew().size() ; i++ ) {
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; }
}
return result; return result;
} }

4
src/storm/modelchecker/rpatl/SparseSmgRpatlModelChecker.cpp

@ -65,6 +65,7 @@ namespace storm {
Environment solverEnv = env; Environment solverEnv = env;
coalitionIndicator(solverEnv, checkTask); coalitionIndicator(solverEnv, checkTask);
storm::logic::GameFormula const& gameFormula = checkTask.getFormula(); storm::logic::GameFormula const& gameFormula = checkTask.getFormula();
storm::logic::Formula const& subFormula = gameFormula.getSubformula(); storm::logic::Formula const& subFormula = gameFormula.getSubformula();
@ -143,6 +144,8 @@ namespace storm {
playerIds.push_back(boost::get<uint_fast64_t>(player) - 1); playerIds.push_back(boost::get<uint_fast64_t>(player) - 1);
} }
} }
//for(auto const& p : playerActionIndices) std::cout << p.first << " - " << p.second << ", "; std::cout << std::endl;
//for(auto const& p : playerIds) std::cout << p << ", "; std::cout << std::endl;
for(uint i = 0; i < playerActionIndices.size(); i++) { for(uint i = 0; i < playerActionIndices.size(); i++) {
if(std::find(playerIds.begin(), playerIds.end(), playerActionIndices.at(i).second) != playerIds.end()) { if(std::find(playerIds.begin(), playerIds.end(), playerActionIndices.at(i).second) != playerIds.end()) {
@ -151,6 +154,7 @@ namespace storm {
} }
coalitionIndicators.complement(); coalitionIndicators.complement();
//std::cout << "MINMAX OVERRIDE: " << coalitionIndicators << std::endl;
env.solver().multiplier().setOptimizationDirectionOverride(coalitionIndicators); env.solver().multiplier().setOptimizationDirectionOverride(coalitionIndicators);
} }

15
src/storm/solver/GmmxxMultiplier.cpp

@ -20,6 +20,7 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
GmmxxMultiplier<ValueType>::GmmxxMultiplier(storm::storage::SparseMatrix<ValueType> const& matrix) : Multiplier<ValueType>(matrix) { GmmxxMultiplier<ValueType>::GmmxxMultiplier(storm::storage::SparseMatrix<ValueType> const& matrix) : Multiplier<ValueType>(matrix) {
// Intentionally left empty. // Intentionally left empty.
//STORM_LOG_DEBUG("\n" << matrix);
} }
template<typename ValueType> template<typename ValueType>
@ -181,6 +182,7 @@ namespace storm {
uint64_t currentRowGroup = backwards ? rowGroupIndices.size() - 1 : 0; uint64_t currentRowGroup = backwards ? rowGroupIndices.size() - 1 : 0;
auto row_group_it = backwards ? rowGroupIndices.end() - 2 : rowGroupIndices.begin(); auto row_group_it = backwards ? rowGroupIndices.end() - 2 : rowGroupIndices.begin();
auto row_group_ite = backwards ? rowGroupIndices.begin() - 1 : rowGroupIndices.end() - 1; auto row_group_ite = backwards ? rowGroupIndices.begin() - 1 : rowGroupIndices.end() - 1;
//if(choices) STORM_LOG_DEBUG(" ");
while (row_group_it != row_group_ite) { while (row_group_it != row_group_ite) {
ValueType currentValue = storm::utility::zero<ValueType>(); ValueType currentValue = storm::utility::zero<ValueType>();
@ -213,6 +215,10 @@ namespace storm {
// Process the (rowGroupSize-1) remaining rows within the current row Group // Process the (rowGroupSize-1) remaining rows within the current row Group
uint64_t rowGroupSize = *(row_group_it + 1) - *row_group_it; uint64_t rowGroupSize = *(row_group_it + 1) - *row_group_it;
uint choiceforprintout = 0;
//std::cout << currentRowGroup << ": " << currentValue << ", ";
//STORM_LOG_DEBUG(std::setprecision(3) << vect_sp(gmm::linalg_traits<MatrixType>::row(itr), x) << " + " << *add_it << "; ");
//STORM_LOG_DEBUG(std::setprecision(3) << vect_sp(gmm::linalg_traits<MatrixType>::row(itr), x) << " + " << *add_it << "; ");
for (uint64_t i = 1; i < rowGroupSize; ++i) { for (uint64_t i = 1; i < rowGroupSize; ++i) {
ValueType newValue = b ? *add_it : storm::utility::zero<ValueType>(); ValueType newValue = b ? *add_it : storm::utility::zero<ValueType>();
newValue += vect_sp(gmm::linalg_traits<MatrixType>::row(itr), x); newValue += vect_sp(gmm::linalg_traits<MatrixType>::row(itr), x);
@ -220,12 +226,13 @@ namespace storm {
if (choices && currentRow == *choice_it + *row_group_it) { if (choices && currentRow == *choice_it + *row_group_it) {
oldSelectedChoiceValue = newValue; oldSelectedChoiceValue = newValue;
} }
//std::cout << newValue << ", ";
if(this->isOverridden(currentRowGroup) ? !compare(newValue, currentValue) : compare(newValue, currentValue)) { //STORM_LOG_DEBUG(std::setprecision(3) << vect_sp(gmm::linalg_traits<MatrixType>::row(itr), x) << " + " << *add_it << "; ");
currentValue = newValue; currentValue = newValue;
if (choices) { if (choices) {
selectedChoice = currentRow - *row_group_it; selectedChoice = currentRow - *row_group_it;
} }
choiceforprintout = currentRow - *row_group_it;
} }
// move row-based iterators to the next row // move row-based iterators to the next row
if (backwards) { if (backwards) {
@ -238,7 +245,8 @@ namespace storm {
++add_it; ++add_it;
} }
} }
//STORM_LOG_DEBUG("\t= " << currentValue << "\tchoice: " << choiceforprintout);
//std::cout << std::fixed << std::setprecision(2) << " | v(" << currentRowGroup << ")=" << currentValue << " c: " << choiceforprintout << " |\n" ;
// Finally write value to target vector. // Finally write value to target vector.
*target_it = currentValue; *target_it = currentValue;
if(choices) { if(choices) {
@ -261,6 +269,7 @@ namespace storm {
++currentRowGroup; ++currentRowGroup;
} }
} }
//std::cout << std::endl;
} }
template<> template<>

6
src/storm/storage/Decomposition.cpp

@ -129,14 +129,14 @@ namespace storm {
template <typename BlockType> template <typename BlockType>
std::ostream& operator<<(std::ostream& out, Decomposition<BlockType> const& decomposition) { std::ostream& operator<<(std::ostream& out, Decomposition<BlockType> const& decomposition) {
out << "["; out << "[ ";
if (decomposition.size() > 0) { if (decomposition.size() > 0) {
for (uint_fast64_t blockIndex = 0; blockIndex < decomposition.size() - 1; ++blockIndex) { for (uint_fast64_t blockIndex = 0; blockIndex < decomposition.size() - 1; ++blockIndex) {
out << decomposition.blocks[blockIndex] << ", "; out << decomposition.blocks[blockIndex] << ", " << std::endl;
} }
out << decomposition.blocks.back(); out << decomposition.blocks.back();
} }
out << "]"; out << " ]";
return out; return out;
} }

2
src/storm/storage/MaximalEndComponent.cpp

@ -103,7 +103,7 @@ namespace storm {
std::ostream& operator<<(std::ostream& out, MaximalEndComponent const& component) { std::ostream& operator<<(std::ostream& out, MaximalEndComponent const& component) {
out << "{"; out << "{";
for (auto const& stateChoicesPair : component.stateToChoicesMapping) { for (auto const& stateChoicesPair : component.stateToChoicesMapping) {
out << "{" << stateChoicesPair.first << ", " << stateChoicesPair.second << "}"; out << "(" << stateChoicesPair.first << ", " << stateChoicesPair.second << ")";
} }
out << "}"; out << "}";

5
src/storm/storage/SparseMatrix.cpp

@ -2350,7 +2350,7 @@ namespace storm {
typename SparseMatrix<ValueType>::index_type currentRealIndex = 0; typename SparseMatrix<ValueType>::index_type currentRealIndex = 0;
while (currentRealIndex < matrix.columnCount) { while (currentRealIndex < matrix.columnCount) {
if (nextIndex < matrix.rowIndications[i + 1] && currentRealIndex == matrix.columnsAndValues[nextIndex].getColumn()) { if (nextIndex < matrix.rowIndications[i + 1] && currentRealIndex == matrix.columnsAndValues[nextIndex].getColumn()) {
out << matrix.columnsAndValues[nextIndex].getValue() << "\t"; out << std::setprecision(3) << matrix.columnsAndValues[nextIndex].getValue() << "\t";
++nextIndex; ++nextIndex;
} else { } else {
out << "0\t"; out << "0\t";
@ -2522,6 +2522,3 @@ namespace storm {
} // namespace storage } // namespace storage
} // namespace storm } // namespace storm
|||||||
100:0
Loading…
Cancel
Save