Browse Source

gspn extension

tempestpy_adaptions
Sebastian Junges 8 years ago
committed by sjunges
parent
commit
77598a8774
  1. 13
      src/storm-gspn/storage/gspn/GSPN.cpp
  2. 17
      src/storm-gspn/storage/gspn/GSPN.h
  3. 3
      src/storm-gspn/storage/gspn/GspnBuilder.cpp
  4. 3
      src/storm-gspn/storm-gspn.h

13
src/storm-gspn/storage/gspn/GSPN.cpp

@ -27,8 +27,8 @@ namespace storm {
return tId;
}
GSPN::GSPN(std::string const& name, std::vector<Place> const& places, std::vector<ImmediateTransition<WeightType>> const& itransitions, std::vector<TimedTransition<RateType>> const& ttransitions, std::vector<TransitionPartition> const& partitions)
: name(name), places(places), immediateTransitions(itransitions), timedTransitions(ttransitions), partitions(partitions)
GSPN::GSPN(std::string const& name, std::vector<Place> const& places, std::vector<ImmediateTransition<WeightType>> const& itransitions, std::vector<TimedTransition<RateType>> const& ttransitions, std::vector<TransitionPartition> const& partitions, std::shared_ptr<storm::expressions::ExpressionManager> const& exprManager)
: name(name), places(places), immediateTransitions(itransitions), timedTransitions(ttransitions), partitions(partitions), exprManager(exprManager);
{
}
@ -134,8 +134,13 @@ namespace storm {
return getImmediateTransition(id);
}
void GSPN::setCapacities(std::unordered_map<std::string, uint64_t> const& mapping) {
std::shared_ptr<storm::expressions::ExpressionManager> const& GSPN::getExpressionManager() {
return exprManager;
}
void GSPN::setCapacities(std::unordered_map<std::string, uint64_t> const& mapping) {
for(auto const& entry : mapping) {
storm::gspn::Place* place = getPlace(entry.first);
STORM_LOG_THROW(place != nullptr, storm::exceptions::InvalidArgumentException, "No place with name " << entry.first);

17
src/storm-gspn/storage/gspn/GSPN.h

@ -6,6 +6,8 @@
#include <memory>
#include <unordered_map>
#include "storm/storage/expressions/ExpressionManager.h"
#include "storm-gspn/storage/gspn/ImmediateTransition.h"
#include "storm-gspn/storage/gspn/Marking.h"
#include "storm-gspn/storage/gspn/Place.h"
@ -30,7 +32,7 @@ namespace storm {
GSPN(std::string const& name, std::vector<Place> const& places, std::vector<ImmediateTransition<WeightType>> const& itransitions,
std::vector<TimedTransition<RateType>> const& ttransitions, std::vector<TransitionPartition> const& partitions);
std::vector<TimedTransition<RateType>> const& ttransitions, std::vector<TransitionPartition> const& partitions, std::shared_ptr<storm::expressions::ExpressionManager> const& exprManager);
/*!
* Returns the number of places in this gspn.
@ -135,7 +137,13 @@ namespace storm {
* @return The name.
*/
std::string const& getName() const;
/*!
* Obtain the expression manager used for expressions over GSPNs.
*
* @return
*/
std::shared_ptr<storm::expressions::ExpressionManager> const& getExpressionManager() const;
/**
* Set Capacities according to name->capacity map.
@ -197,7 +205,10 @@ namespace storm {
std::vector<storm::gspn::TimedTransition<RateType>> timedTransitions;
std::vector<storm::gspn::TransitionPartition> partitions;
std::shared_ptr<storm::expressions::ExpressionManager> exprManager;
// Layout information
mutable std::map<uint64_t, LayoutInfo> placeLayout;
mutable std::map<uint64_t, LayoutInfo> transitionLayout;

3
src/storm-gspn/storage/gspn/GspnBuilder.cpp

@ -164,6 +164,9 @@ namespace storm {
storm::gspn::GSPN* GspnBuilder::buildGspn() const {
std::shared_ptr<storm::expressions::ExpressionManager> exprManager(new storm::expressions::ExpressionManager());
exprManager->
std::vector<TransitionPartition> orderedPartitions;
for(auto const& priorityPartitions : partitions) {
for (auto const& partition : priorityPartitions.second) {

3
src/storm-gspn/storm-gspn.h

@ -13,8 +13,7 @@ namespace storm {
* Builds JANI model from GSPN.
*/
storm::jani::Model* buildJani(storm::gspn::GSPN const& gspn) {
std::shared_ptr<storm::expressions::ExpressionManager> exprManager(new storm::expressions::ExpressionManager());
storm::builder::JaniGSPNBuilder builder(gspn, exprManager);
storm::builder::JaniGSPNBuilder builder(gspn);
return builder.build();
}

Loading…
Cancel
Save