Browse Source

Add message if nothing about monotonicity is known

tempestpy_adaptions
Jip Spel 6 years ago
parent
commit
b0551b540a
  1. 21
      src/storm-pars/analysis/MonotonicityChecker.cpp

21
src/storm-pars/analysis/MonotonicityChecker.cpp

@ -68,15 +68,19 @@ namespace storm {
template <typename ValueType>
std::map<storm::analysis::Lattice*, std::map<carl::Variable, std::pair<bool, bool>>> MonotonicityChecker<ValueType>::checkMonotonicity(std::map<storm::analysis::Lattice*, std::vector<std::shared_ptr<storm::expressions::BinaryRelationExpression>>> map, storm::storage::SparseMatrix<ValueType> matrix) {
storm::utility::Stopwatch finalCheckWatch(true);
std::map<storm::analysis::Lattice *, std::map<carl::Variable, std::pair<bool, bool>>> result;
if (map.size() == 0) {
STORM_PRINT(std::endl << "Do not know about monotonicity" << std::endl);
} else {
auto i = 0;
std::map<storm::analysis::Lattice*, std::map<carl::Variable, std::pair<bool, bool>>> result;
for (auto itr = map.begin(); i < map.size() && itr != map.end(); ++itr) {
auto lattice = itr->first;
auto assumptions = itr->second;
std::ofstream myfile;
std::string filename = "lattice" + std::to_string(i) + ".dot";
myfile.open (filename);
myfile.open(filename);
lattice->toDotFile(myfile);
myfile.close();
@ -99,24 +103,28 @@ namespace storm {
STORM_PRINT(std::endl);
}
std::map<carl::Variable, std::pair<bool, bool>> varsMonotone = analyseMonotonicity(i, lattice, matrix);
std::map<carl::Variable, std::pair<bool, bool>> varsMonotone = analyseMonotonicity(i, lattice,
matrix);
if (varsMonotone.size() == 0) {
STORM_PRINT("Result is constant" << std::endl);
} else {
for (auto itr2 = varsMonotone.begin(); itr2 != varsMonotone.end(); ++itr2) {
if (resultCheckOnSamples.find(itr2->first) != resultCheckOnSamples.end() &&
(!resultCheckOnSamples[itr2->first].first && !resultCheckOnSamples[itr2->first].second)) {
(!resultCheckOnSamples[itr2->first].first &&
!resultCheckOnSamples[itr2->first].second)) {
STORM_PRINT(" - Not monotone in: " << itr2->first << std::endl);
} else {
if (itr2->second.first) {
STORM_PRINT(" - Monotone increasing in: " << itr2->first << std::endl);
} else {
STORM_PRINT(" - Do not know if monotone increasing in: " << itr2->first << std::endl);
STORM_PRINT(
" - Do not know if monotone increasing in: " << itr2->first << std::endl);
}
if (itr2->second.second) {
STORM_PRINT(" - Monotone decreasing in: " << itr2->first << std::endl);
} else {
STORM_PRINT(" - Do not know if monotone decreasing in: " << itr2->first << std::endl);
STORM_PRINT(
" - Do not know if monotone decreasing in: " << itr2->first << std::endl);
}
}
}
@ -126,6 +134,7 @@ namespace storm {
}
++i;
}
}
finalCheckWatch.stop();
STORM_PRINT(std::endl << "Time for monotonicity check on lattice: " << finalCheckWatch << "." << std::endl << std::endl);

Loading…
Cancel
Save