Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/storm-cli-utilities/model-handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,29 @@ std::pair<std::shared_ptr<storm::models::ModelBase>, bool> preprocessModel(std::
STORM_PRINT_AND_LOG("Transition matrix hash after permuting: " << result.first->getTransitionMatrix().hash() << ".\n");
}

// Merging of states should be done before applying bisimulation as this order leads to the smallest quotient
if (transformationSettings.isMergeEquivalentStatesSet()) {
if constexpr (storm::IsIntervalType<ValueType>) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Merging equivalent states not supported for interval models.");
} else {
auto formulas = createFormulasToRespect(input.properties);
if (formulas.size() == 1) {
auto mergedModel = storm::api::mergeEquivalentStatesForFormula<ValueType>(result.first, *formulas.front());
if (mergedModel) {
STORM_LOG_INFO("Merged equivalent states for the considered property '" << *formulas.front() << "'.");
result.first = mergedModel;
result.second = true;
} else {
STORM_LOG_WARN("Merging equivalent states is not supported for the considered " << result.first->getType() << " model and property '"
<< *formulas.front() << "'.");
}
} else {
STORM_LOG_WARN("Skipping merging of equivalent states as it requires exactly one input property. " << formulas.size()
<< " properties given instead.");
}
}
}

if (result.first->isOfType(storm::models::ModelType::MarkovAutomaton)) {
result.first = preprocessSparseMarkovAutomaton(result.first->template as<storm::models::sparse::MarkovAutomaton<ValueType>>());
result.second = true;
Expand Down
2 changes: 0 additions & 2 deletions src/storm-pars-cli/sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "storm-pars/settings/modules/RegionSettings.h"

#include "storm-pars/derivative/GradientDescentMethod.h"
#include "storm-pars/transformer/SparseParametricDtmcSimplifier.h"
#include "storm-pars/transformer/SparseParametricMdpSimplifier.h"

#include "storm-pars/utility/parametric.h"

Expand Down
7 changes: 3 additions & 4 deletions src/storm-pars-cli/storm-pars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "storm-pars/settings/modules/SamplingSettings.h"
#include "storm-pars/transformer/BigStep.h"
#include "storm-pars/transformer/BinaryDtmcTransformer.h"
#include "storm-pars/transformer/SparseParametricDtmcSimplifier.h"
#include "storm-pars/transformer/SparseParametricMdpSimplifier.h"
#include "storm-pars/transformer/SparseParametricModelSimplifier.h"
#include "storm-pars/utility/parametric.h"
#include "storm/api/storm.h"
#include "storm/exceptions/BaseException.h"
Expand Down Expand Up @@ -159,7 +158,7 @@ std::shared_ptr<storm::models::ModelBase> simplifyModel(std::shared_ptr<storm::m
storm::utility::Stopwatch simplifyingWatch(true);
std::shared_ptr<storm::models::ModelBase> result;
if (model->isOfType(storm::models::ModelType::Dtmc)) {
storm::transformer::SparseParametricDtmcSimplifier<storm::models::sparse::Dtmc<ValueType>> simplifier(
storm::transformer::SparseParametricModelSimplifier<storm::models::sparse::Dtmc<ValueType>> simplifier(
*(model->template as<storm::models::sparse::Dtmc<ValueType>>()));

std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(input.properties);
Expand All @@ -168,7 +167,7 @@ std::shared_ptr<storm::models::ModelBase> simplifyModel(std::shared_ptr<storm::m
STORM_LOG_THROW(simplifier.simplify(*(formulas[0])), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
result = simplifier.getSimplifiedModel();
} else if (model->isOfType(storm::models::ModelType::Mdp)) {
storm::transformer::SparseParametricMdpSimplifier<storm::models::sparse::Mdp<ValueType>> simplifier(
storm::transformer::SparseParametricModelSimplifier<storm::models::sparse::Mdp<ValueType>> simplifier(
*(model->template as<storm::models::sparse::Mdp<ValueType>>()));

std::vector<std::shared_ptr<storm::logic::Formula const>> formulas = storm::api::extractFormulasFromProperties(input.properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "storm-pars/modelchecker/region/monotonicity/OrderBasedMonotonicityBackend.h"
#include "storm-pars/transformer/BigStep.h"
#include "storm-pars/transformer/IntervalEndComponentPreserver.h"
#include "storm-pars/transformer/SparseParametricDtmcSimplifier.h"
#include "storm-pars/transformer/SparseParametricModelSimplifier.h"
#include "storm/adapters/RationalFunctionAdapter.h"
#include "storm/adapters/RationalFunctionForward.h"
#include "storm/environment/Environment.h"
Expand Down Expand Up @@ -93,7 +93,7 @@ void SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robus
reset();

if (allowModelSimplifications && graphPreserving) {
auto simplifier = storm::transformer::SparseParametricDtmcSimplifier<SparseModelType>(*dtmc);
auto simplifier = storm::transformer::SparseParametricModelSimplifier<SparseModelType>(*dtmc);
simplifier.setPreserveParametricTransitions(true);
STORM_LOG_THROW(simplifier.simplify(checkTask.getFormula()), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
this->parametricModel = simplifier.getSimplifiedModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "storm-pars/modelchecker/region/AnnotatedRegion.h"
#include "storm-pars/modelchecker/region/monotonicity/MonotonicityBackend.h"
#include "storm-pars/transformer/SparseParametricMdpSimplifier.h"
#include "storm-pars/transformer/SparseParametricModelSimplifier.h"
#include "storm/adapters/RationalFunctionAdapter.h"
#include "storm/exceptions/InvalidPropertyException.h"
#include "storm/exceptions/NotImplementedException.h"
Expand Down Expand Up @@ -68,7 +68,7 @@ void SparseMdpParameterLiftingModelChecker<SparseModelType, ConstantType>::speci
reset();

if (allowModelSimplifications) {
auto simplifier = storm::transformer::SparseParametricMdpSimplifier<SparseModelType>(*mdp);
auto simplifier = storm::transformer::SparseParametricModelSimplifier<SparseModelType>(*mdp);
STORM_LOG_THROW(simplifier.simplify(checkTask.getFormula()), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
this->parametricModel = simplifier.getSimplifiedModel();
this->specifyFormula(env, checkTask.substituteFormula(*simplifier.getSimplifiedFormula()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "storm-pars/modelchecker/region/AnnotatedRegion.h"
#include "storm-pars/modelchecker/region/monotonicity/MonotonicityBackend.h"
#include "storm-pars/transformer/SparseParametricDtmcSimplifier.h"
#include "storm-pars/transformer/SparseParametricMdpSimplifier.h"
#include "storm-pars/transformer/SparseParametricModelSimplifier.h"
#include "storm/adapters/RationalFunctionAdapter.h"
#include "storm/exceptions/NotImplementedException.h"
#include "storm/exceptions/NotSupportedException.h"
Expand Down Expand Up @@ -50,17 +49,10 @@ void ValidatingSparseParameterLiftingModelChecker<SparseModelType, ImpreciseType

if (allowModelSimplifications) {
auto dtmcOrMdp = parametricModel->template as<SparseModelType>();
if constexpr (IsMDP) {
auto simplifier = storm::transformer::SparseParametricMdpSimplifier<SparseModelType>(*dtmcOrMdp);
STORM_LOG_THROW(simplifier.simplify(checkTask.getFormula()), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
auto simplifiedTask = checkTask.substituteFormula(*simplifier.getSimplifiedFormula());
specifyUnderlyingCheckers(simplifier.getSimplifiedModel(), simplifiedTask);
} else {
auto simplifier = storm::transformer::SparseParametricDtmcSimplifier<SparseModelType>(*dtmcOrMdp);
STORM_LOG_THROW(simplifier.simplify(checkTask.getFormula()), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
auto simplifiedTask = checkTask.substituteFormula(*simplifier.getSimplifiedFormula());
specifyUnderlyingCheckers(simplifier.getSimplifiedModel(), simplifiedTask);
}
auto simplifier = storm::transformer::SparseParametricModelSimplifier<SparseModelType>(*dtmcOrMdp);
STORM_LOG_THROW(simplifier.simplify(checkTask.getFormula()), storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
auto simplifiedTask = checkTask.substituteFormula(*simplifier.getSimplifiedFormula());
specifyUnderlyingCheckers(simplifier.getSimplifiedModel(), simplifiedTask);
} else {
specifyUnderlyingCheckers(parametricModel, checkTask);
}
Expand Down
Loading
Loading