Browse Source

Jani: Fixed an issue where initial expressions for unbounded variables have not been substituted correctly.

tempestpy_adaptions
Tim Quatmann 6 years ago
parent
commit
bc32853c28
  1. 11
      src/storm/storage/jani/Automaton.cpp
  2. 10
      src/storm/storage/jani/Model.cpp
  3. 6
      src/storm/storage/jani/VariableSet.cpp
  4. 7
      src/storm/storage/jani/VariableSet.h

11
src/storm/storage/jani/Automaton.cpp

@ -440,15 +440,8 @@ namespace storm {
for (auto& functionDefinition : this->getFunctionDefinitions()) { for (auto& functionDefinition : this->getFunctionDefinitions()) {
functionDefinition.second.substitute(substitution); functionDefinition.second.substitute(substitution);
} }
for (auto& variable : this->getVariables().getBoundedIntegerVariables()) {
variable.substitute(substitution);
}
for (auto& variable : this->getVariables().getArrayVariables()) {
variable.substitute(substitution);
}
for (auto& variable : this->getVariables().getClockVariables()) {
variable.substitute(substitution);
}
this->getVariables().substitute(substitution);
for (auto& location : this->getLocations()) { for (auto& location : this->getLocations()) {
location.substitute(substitution); location.substitute(substitution);

10
src/storm/storage/jani/Model.cpp

@ -1036,15 +1036,7 @@ namespace storm {
} }
// Substitute constants in all global variables. // Substitute constants in all global variables.
for (auto& variable : result.getGlobalVariables().getBoundedIntegerVariables()) {
variable.substitute(constantSubstitution);
}
for (auto& variable : result.getGlobalVariables().getArrayVariables()) {
variable.substitute(constantSubstitution);
}
for (auto& variable : result.getGlobalVariables().getClockVariables()) {
variable.substitute(constantSubstitution);
}
result.getGlobalVariables().substitute(constantSubstitution);
// Substitute constants in initial states expression. // Substitute constants in initial states expression.
result.setInitialStatesRestriction(substituteJaniExpression(this->getInitialStatesRestriction(), constantSubstitution)); result.setInitialStatesRestriction(substituteJaniExpression(this->getInitialStatesRestriction(), constantSubstitution));

6
src/storm/storage/jani/VariableSet.cpp

@ -423,5 +423,11 @@ namespace storm {
return result; return result;
} }
void VariableSet::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) {
for (auto& variable : variables) {
variable.substitute(substitution);
}
}
} }
} }

7
src/storm/storage/jani/VariableSet.h

@ -265,6 +265,13 @@ namespace storm {
*/ */
std::map<std::string, std::reference_wrapper<Variable const>> getNameToVariableMap() const; std::map<std::string, std::reference_wrapper<Variable const>> getNameToVariableMap() const;
/*!
* Applies the given substitution to all variables in this set.
* The substitution does not apply to the variables itself, but to initial expressions, variable bounds, ...
* @param substitution
*/
void substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution);
private: private:
/// The vector of all variables. /// The vector of all variables.
std::vector<std::shared_ptr<Variable>> variables; std::vector<std::shared_ptr<Variable>> variables;

Loading…
Cancel
Save