Browse Source

More debug stats.

Former-commit-id: 1885b7ff67
tempestpy_adaptions
dehnert 10 years ago
parent
commit
0af2b8d148
  1. 19
      src/storage/DeterministicModelBisimulationDecomposition.cpp

19
src/storage/DeterministicModelBisimulationDecomposition.cpp

@ -746,7 +746,7 @@ namespace storm {
static int callsToRefinePartition = 0; static int callsToRefinePartition = 0;
static int statesIteratedOverInRefinePartition = 0; static int statesIteratedOverInRefinePartition = 0;
static std::vector<int> refinementOrder;
static std::chrono::high_resolution_clock::duration refineBlockTime(0);
template<typename ValueType> template<typename ValueType>
template<typename ModelType> template<typename ModelType>
@ -758,6 +758,9 @@ namespace storm {
std::deque<Block*> splitterQueue; std::deque<Block*> splitterQueue;
std::for_each(partition.getBlocks().begin(), partition.getBlocks().end(), [&] (Block& a) { splitterQueue.push_back(&a); a.markAsSplitter(); }); std::for_each(partition.getBlocks().begin(), partition.getBlocks().end(), [&] (Block& a) { splitterQueue.push_back(&a); a.markAsSplitter(); });
std::chrono::high_resolution_clock::time_point refinePartitionStart;
std::chrono::high_resolution_clock::duration refinePartitionTime(0);
// Then perform the actual splitting until there are no more splitters. // Then perform the actual splitting until there are no more splitters.
while (!splitterQueue.empty()) { while (!splitterQueue.empty()) {
// Optionally: sort the splitter queue according to some criterion (here: prefer small splitters). // Optionally: sort the splitter queue according to some criterion (here: prefer small splitters).
@ -769,7 +772,9 @@ namespace storm {
splitter->unmarkAsSplitter(); splitter->unmarkAsSplitter();
// Now refine the partition using the current splitter. // Now refine the partition using the current splitter.
std::chrono::high_resolution_clock::time_point refinePartitionStart = std::chrono::high_resolution_clock::now();
refinePartition(model.getTransitionMatrix(), backwardTransitions, *splitter, partition, bisimulationType, splitterQueue); refinePartition(model.getTransitionMatrix(), backwardTransitions, *splitter, partition, bisimulationType, splitterQueue);
refinePartitionTime += std::chrono::high_resolution_clock::now() - refinePartitionStart;
} }
std::chrono::high_resolution_clock::duration refinementTime = std::chrono::high_resolution_clock::now() - refinementStart; std::chrono::high_resolution_clock::duration refinementTime = std::chrono::high_resolution_clock::now() - refinementStart;
@ -796,11 +801,15 @@ namespace storm {
if (storm::settings::generalSettings().isShowStatisticsSet()) { if (storm::settings::generalSettings().isShowStatisticsSet()) {
std::chrono::milliseconds refinementTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(refinementTime); std::chrono::milliseconds refinementTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(refinementTime);
std::chrono::milliseconds refinePartitionTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(refinePartitionTime);
std::chrono::milliseconds refineBlockTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(refineBlockTime);
std::chrono::milliseconds extractionTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(extractionTime); std::chrono::milliseconds extractionTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(extractionTime);
std::chrono::milliseconds totalTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(totalTime); std::chrono::milliseconds totalTimeInMilliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(totalTime);
std::cout << std::endl; std::cout << std::endl;
std::cout << "Time breakdown:" << std::endl; std::cout << "Time breakdown:" << std::endl;
std::cout << " * time for partitioning: " << refinementTimeInMilliseconds.count() << "ms" << std::endl; std::cout << " * time for partitioning: " << refinementTimeInMilliseconds.count() << "ms" << std::endl;
std::cout << " * time spent in refining partition: " << refinePartitionTimeInMilliseconds.count() << "ms" << std::endl;
std::cout << " * time spent in refining block based on probabilities: " << refineBlockTimeInMilliseconds.count() << "ms" << std::endl;
std::cout << " * time for extraction: " << extractionTimeInMilliseconds.count() << "ms" << std::endl; std::cout << " * time for extraction: " << extractionTimeInMilliseconds.count() << "ms" << std::endl;
std::cout << "------------------------------------------" << std::endl; std::cout << "------------------------------------------" << std::endl;
std::cout << " * total time: " << totalTimeInMilliseconds.count() << "ms" << std::endl; std::cout << " * total time: " << totalTimeInMilliseconds.count() << "ms" << std::endl;
@ -808,16 +817,13 @@ namespace storm {
std::cout << "Other:" << std::endl; std::cout << "Other:" << std::endl;
std::cout << " * calls to refine partition: " << callsToRefinePartition << std::endl; std::cout << " * calls to refine partition: " << callsToRefinePartition << std::endl;
std::cout << " * states iterated over: " << statesIteratedOverInRefinePartition << std::endl; std::cout << " * states iterated over: " << statesIteratedOverInRefinePartition << std::endl;
std::cout << " * order: ";
for (auto const& element : refinementOrder) {
std::cout << element << ", ";
}
std::cout << std::endl; std::cout << std::endl;
} }
} }
template<typename ValueType> template<typename ValueType>
void DeterministicModelBisimulationDecomposition<ValueType>::refineBlockProbabilities(Block& block, Partition& partition, BisimulationType bisimulationType, std::deque<Block*>& splitterQueue) { void DeterministicModelBisimulationDecomposition<ValueType>::refineBlockProbabilities(Block& block, Partition& partition, BisimulationType bisimulationType, std::deque<Block*>& splitterQueue) {
std::chrono::high_resolution_clock::time_point refinePartitionStart = std::chrono::high_resolution_clock::now();
// Sort the states in the block based on their probabilities. // Sort the states in the block based on their probabilities.
std::sort(partition.getBegin(block), partition.getEnd(block), [&partition] (std::pair<storm::storage::sparse::state_type, ValueType> const& a, std::pair<storm::storage::sparse::state_type, ValueType> const& b) { return a.second < b.second; } ); std::sort(partition.getBegin(block), partition.getEnd(block), [&partition] (std::pair<storm::storage::sparse::state_type, ValueType> const& a, std::pair<storm::storage::sparse::state_type, ValueType> const& b) { return a.second < b.second; } );
@ -864,6 +870,8 @@ namespace storm {
block.markAsSplitter(); block.markAsSplitter();
} }
} }
refineBlockTime += std::chrono::high_resolution_clock::now() - refinePartitionStart;
} }
template<typename ValueType> template<typename ValueType>
@ -1041,7 +1049,6 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
void DeterministicModelBisimulationDecomposition<ValueType>::refinePartition(storm::storage::SparseMatrix<ValueType> const& forwardTransitions, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, Block& splitter, Partition& partition, BisimulationType bisimulationType, std::deque<Block*>& splitterQueue) { void DeterministicModelBisimulationDecomposition<ValueType>::refinePartition(storm::storage::SparseMatrix<ValueType> const& forwardTransitions, storm::storage::SparseMatrix<ValueType> const& backwardTransitions, Block& splitter, Partition& partition, BisimulationType bisimulationType, std::deque<Block*>& splitterQueue) {
++callsToRefinePartition; ++callsToRefinePartition;
refinementOrder.push_back(splitter.getId());
std::list<Block*> predecessorBlocks; std::list<Block*> predecessorBlocks;
// Iterate over all states of the splitter and check its predecessors. // Iterate over all states of the splitter and check its predecessors.

Loading…
Cancel
Save