Browse Source
JANI next-state generator appears to be working (without rewards)
JANI next-state generator appears to be working (without rewards)
Former-commit-id: 3ca5c3ccf2
main
10 changed files with 138 additions and 30 deletions
-
24src/generator/JaniNextStateGenerator.cpp
-
2src/generator/VariableInformation.cpp
-
12src/storage/jani/Automaton.cpp
-
2src/storage/jani/Automaton.h
-
9src/storage/jani/CompositionInformationVisitor.cpp
-
2src/storage/jani/CompositionInformationVisitor.h
-
66src/storage/prism/CompositionToJaniVisitor.cpp
-
29src/storage/prism/CompositionToJaniVisitor.h
-
8src/storage/prism/Program.cpp
-
10test/functional/permissiveschedulers/SmtPermissiveSchedulerTest.cpp
@ -0,0 +1,66 @@ |
|||||
|
#include "src/storage/prism/CompositionToJaniVisitor.h"
|
||||
|
#include "src/storage/prism/Compositions.h"
|
||||
|
|
||||
|
#include "src/storage/jani/Compositions.h"
|
||||
|
#include "src/storage/jani/Model.h"
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace prism { |
||||
|
|
||||
|
std::shared_ptr<storm::jani::Composition> CompositionToJaniVisitor::toJani(Composition const& composition, storm::jani::Model const& model) { |
||||
|
return boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.accept(*this, model)); |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(ModuleComposition const& composition, boost::any const& data) { |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::AutomatonComposition>(composition.getModuleName()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(RenamingComposition const& composition, boost::any const& data) { |
||||
|
std::map<std::string, boost::optional<std::string>> newRenaming; |
||||
|
for (auto const& renamingPair : composition.getActionRenaming()) { |
||||
|
newRenaming.emplace(renamingPair.first, renamingPair.second); |
||||
|
} |
||||
|
auto subcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getSubcomposition().accept(*this, data)); |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::RenameComposition>(subcomposition, newRenaming); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(HidingComposition const& composition, boost::any const& data) { |
||||
|
std::map<std::string, boost::optional<std::string>> newRenaming; |
||||
|
for (auto const& action : composition.getActionsToHide()) { |
||||
|
newRenaming.emplace(action, boost::none); |
||||
|
} |
||||
|
auto subcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getSubcomposition().accept(*this, data)); |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::RenameComposition>(subcomposition, newRenaming); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(SynchronizingParallelComposition const& composition, boost::any const& data) { |
||||
|
auto leftSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getLeftSubcomposition().accept(*this, data)); |
||||
|
auto rightSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getRightSubcomposition().accept(*this, data)); |
||||
|
|
||||
|
storm::jani::Model const& model = boost::any_cast<storm::jani::Model const&>(data); |
||||
|
std::set<std::string> allActions; |
||||
|
for (auto const& action : model.getActions()) { |
||||
|
allActions.insert(action.getName()); |
||||
|
} |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::ParallelComposition>(leftSubcomposition, rightSubcomposition, allActions); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(InterleavingParallelComposition const& composition, boost::any const& data) { |
||||
|
auto leftSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getLeftSubcomposition().accept(*this, data)); |
||||
|
auto rightSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getRightSubcomposition().accept(*this, data)); |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::ParallelComposition>(leftSubcomposition, rightSubcomposition, std::set<std::string>()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
boost::any CompositionToJaniVisitor::visit(RestrictedParallelComposition const& composition, boost::any const& data) { |
||||
|
auto leftSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getLeftSubcomposition().accept(*this, data)); |
||||
|
auto rightSubcomposition = boost::any_cast<std::shared_ptr<storm::jani::Composition>>(composition.getRightSubcomposition().accept(*this, data)); |
||||
|
std::shared_ptr<storm::jani::Composition> result = std::make_shared<storm::jani::ParallelComposition>(leftSubcomposition, rightSubcomposition, composition.getSynchronizingActions()); |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include <memory> |
||||
|
|
||||
|
#include "src/storage/prism/CompositionVisitor.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace jani { |
||||
|
class Composition; |
||||
|
class Model; |
||||
|
} |
||||
|
|
||||
|
namespace prism { |
||||
|
class Composition; |
||||
|
|
||||
|
class CompositionToJaniVisitor : public CompositionVisitor { |
||||
|
public: |
||||
|
std::shared_ptr<storm::jani::Composition> toJani(Composition const& composition, storm::jani::Model const& model); |
||||
|
|
||||
|
virtual boost::any visit(ModuleComposition const& composition, boost::any const& data) override; |
||||
|
virtual boost::any visit(RenamingComposition const& composition, boost::any const& data) override; |
||||
|
virtual boost::any visit(HidingComposition const& composition, boost::any const& data) override; |
||||
|
virtual boost::any visit(SynchronizingParallelComposition const& composition, boost::any const& data) override; |
||||
|
virtual boost::any visit(InterleavingParallelComposition const& composition, boost::any const& data) override; |
||||
|
virtual boost::any visit(RestrictedParallelComposition const& composition, boost::any const& data) override; |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue