STORM_LOG_THROW(propertyStructure.count("exp")==1,storm::exceptions::InvalidJaniException,"Expecting operand for operator "<<opstring<<" in "<<scope.description);
return{parseFormula(model,propertyStructure.at("exp"),formulaContext,scope.refine("Operand of operator "+opstring))};
STORM_LOG_THROW(propertyStructure.count("left")==1,storm::exceptions::InvalidJaniException,"Expecting left operand for operator "<<opstring<<" in "<<scope.description);
STORM_LOG_THROW(propertyStructure.count("right")==1,storm::exceptions::InvalidJaniException,"Expecting right operand for operator "<<opstring<<" in "<<scope.description);
return{parseFormula(model,propertyStructure.at("left"),formulaContext,scope.refine("Operand of operator "+opstring)),parseFormula(model,propertyStructure.at("right"),formulaContext,scope.refine("Operand of operator "+opstring))};
autoboundExpr=parseExpression(propertyStructure.at(leftRight[1-i]),scope.refine("Threshold for operator "+propertyStructure.at(leftRight[i]).at("op").get<std::string>()));
autoboundExpr=parseExpression(propertyStructure.at(leftRight[1-i]),scope.refine("Threshold for operator "+propertyStructure.at(leftRight[i]).at("op").templateget<std::string>()));
if((opString=="="||opString=="≠")){
STORM_LOG_THROW(!boundExpr.containsVariables(),storm::exceptions::NotSupportedException,"Comparison operators '=' or '≠' in property specifications are currently not supported.");
STORM_LOG_THROW(expressionStructure.count("op")==1,storm::exceptions::InvalidJaniException,"Expression in property must have an operation description");
STORM_LOG_THROW(expressionStructure.at("op")=="filter",storm::exceptions::InvalidJaniException,"Top level operation of a property must be a filter");
STORM_LOG_THROW(expressionStructure.count("fun")==1,storm::exceptions::InvalidJaniException,"Filter must have a function descritpion");
std::stringfunDescr=getString(expressionStructure.at("fun"),"Filter function in property named "+name);
std::stringfunDescr=getString<ValueType>(expressionStructure.at("fun"),"Filter function in property named "+name);
storm::modelchecker::FilterTypeft;
if(funDescr=="min"){
ft=storm::modelchecker::FilterType::MIN;
@ -621,7 +639,7 @@ namespace storm {
STORM_LOG_THROW(expressionStructure.count("states")==1,storm::exceptions::InvalidJaniException,"Filter must have a states description");
STORM_LOG_THROW(constantStructure.count("name")==1,storm::exceptions::InvalidJaniException,"Variable (scope: "+scope.description+") must have a name");
std::stringname=getString(constantStructure.at("name"),"variable-name in "+scope.description+"-scope");
std::stringname=getString<ValueType>(constantStructure.at("name"),"variable-name in "+scope.description+"-scope");
STORM_LOG_THROW(typeStructure.count("kind")==1,storm::exceptions::InvalidJaniException,"For complex type as in variable "<<variableName<<"(scope: "<<scope.description<<") kind must be given");
std::stringkind=getString(typeStructure.at("kind"),"kind for complex type as in variable "+variableName+"(scope: "+scope.description+") ");
std::stringkind=getString<ValueType>(typeStructure.at("kind"),"kind for complex type as in variable "+variableName+"(scope: "+scope.description+") ");
if(kind=="bounded"){
STORM_LOG_THROW(typeStructure.count("lower-bound")+typeStructure.count("upper-bound")>0,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<variableName<<"(scope: "<<scope.description<<") lower-bound or upper-bound must be given");
storm::expressions::ExpressionlowerboundExpr;
@ -721,7 +741,7 @@ namespace storm {
upperboundExpr=parseExpression(typeStructure.at("upper-bound"),scope.refine("Upper bound for variable "+variableName));
}
STORM_LOG_THROW(typeStructure.count("base")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<variableName<<"(scope: "<<scope.description<<") base must be given");
std::stringbasictype=getString(typeStructure.at("base"),"base for bounded type as in variable "+variableName+"(scope: "+scope.description+") ");
std::stringbasictype=getString<ValueType>(typeStructure.at("base"),"base for bounded type as in variable "+variableName+"(scope: "+scope.description+") ");
if(basictype=="int"){
STORM_LOG_THROW(!lowerboundExpr.isInitialized()||lowerboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Lower bound for bounded integer variable "<<variableName<<"(scope: "<<scope.description<<") must be integer-typed");
STORM_LOG_THROW(!upperboundExpr.isInitialized()||upperboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Upper bound for bounded integer variable "<<variableName<<"(scope: "<<scope.description<<") must be integer-typed");
STORM_LOG_THROW(functionDefinitionStructure.count("name")==1,storm::exceptions::InvalidJaniException,"Function definition (scope: "+scope.description+") must have a name");
std::stringfunctionName=getString(functionDefinitionStructure.at("name"),"function-name in "+scope.description);
std::stringfunctionName=getString<ValueType>(functionDefinitionStructure.at("name"),"function-name in "+scope.description);
STORM_LOG_THROW(functionDefinitionStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Function definition '"+functionName+"' (scope: "+scope.description+") must have a (single) type-declaration.");
STORM_LOG_THROW(functionDefinitionStructure.count("parameters")==1,storm::exceptions::InvalidJaniException,"Function definition '"+functionName+"' (scope: "+scope.description+") must have exactly one list of parameters.");
STORM_LOG_THROW(parameterStructure.count("name")==1,storm::exceptions::InvalidJaniException,"Parameter declaration of parameter "+std::to_string(parameters.size())+" of Function definition '"+functionName+"' (scope: "+scope.description+") must have a name");
std::stringparameterName=getString(parameterStructure.at("name"),"parameter-name of parameter "+std::to_string(parameters.size())+" of Function definition '"+functionName+"' (scope: "+scope.description+").");
std::stringparameterName=getString<ValueType>(parameterStructure.at("name"),"parameter-name of parameter "+std::to_string(parameters.size())+" of Function definition '"+functionName+"' (scope: "+scope.description+").");
ParsedTypeparameterType;
STORM_LOG_THROW(parameterStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Parameter declaration of parameter "+std::to_string(parameters.size())+" of Function definition '"+functionName+"' (scope: "+scope.description+") must have exactly one type.");
parseType(parameterType,parameterStructure.at("type"),parameterName,scope.refine("parameter declaration of parameter "+std::to_string(parameters.size())+" of function definition "+functionName));
STORM_LOG_THROW(variableStructure.count("name")==1,storm::exceptions::InvalidJaniException,"Variable (scope: "+scope.description+") must have a name");
std::stringname=getString(variableStructure.at("name"),"variable-name in "+scope.description+"-scope");
std::stringname=getString<ValueType>(variableStructure.at("name"),"variable-name in "+scope.description+"-scope");
STORM_LOG_THROW(tvarcount<=1,storm::exceptions::InvalidJaniException,"Multiple definitions of transient not allowed in variable '"+name+"' (scope: "+scope.description+").");
if(tvarcount==1){
transientVar=getBoolean(variableStructure.at("transient"),"transient-attribute in variable '"+name+"' (scope: "+scope.description+").");
transientVar=getBoolean<ValueType>(variableStructure.at("transient"),"transient-attribute in variable '"+name+"' (scope: "+scope.description+").");
}
STORM_LOG_THROW(variableStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Variable '"+name+"' (scope: "+scope.description+") must have a (single) type-declaration.");
ParsedTypetype;
@ -928,12 +950,14 @@ namespace storm {
STORM_LOG_THROW(expected==actual,storm::exceptions::InvalidJaniException,"Operator "<<opstring<<" expects "<<expected<<" arguments, but got "<<actual<<" in "<<errorInfo<<".");
storm::expressions::Expressionleft=parseExpression(expressionDecl.at("exp"),scope.refine("Argument of operator "+opstring),returnNoneInitializedOnUnknownOperator,auxiliaryVariables);
storm::expressions::Expressionleft=parseExpression(expressionDecl.at("left"),scope.refine("Left argument of operator "+opstring),returnNoneInitializedOnUnknownOperator,auxiliaryVariables);
storm::expressions::Expressionright=parseExpression(expressionDecl.at("right"),scope.refine("Right argument of operator "+opstring),returnNoneInitializedOnUnknownOperator,auxiliaryVariables);
return{left,right};
@ -966,9 +990,10 @@ namespace storm {
STORM_LOG_THROW(expr.getType().isArrayType(),storm::exceptions::InvalidJaniException,"Operator "<<opstring<<" expects argument "+std::to_string(argNr)+" to be of type 'array' in "<<errorInfo<<".");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Distributions are not supported by storm expressions, cannot import "<<expressionStructure.dump()<<" in "<<scope.description<<".");
storm::expressions::Expressionlength=parseExpression(expressionStructure.at("length"),scope.refine("index of array constructor expression"),returnNoneInitializedOnUnknownOperator,auxiliaryVariables);
STORM_LOG_THROW(expressionStructure.count("var")==1,storm::exceptions::InvalidJaniException,"Array access operator requires exactly one var (at "+scope.description+").");
std::stringindexVarName=getString(expressionStructure.at("var"),"Field 'var' of Array access operator (at "+scope.description+").");
std::stringindexVarName=getString<ValueType>(expressionStructure.at("var"),"Field 'var' of Array access operator (at "+scope.description+").");
STORM_LOG_THROW(auxiliaryVariables.find(indexVarName)==auxiliaryVariables.end(),storm::exceptions::InvalidJaniException,"Index variable "<<indexVarName<<" is already defined as an auxiliary variable (at "+scope.description+").");
STORM_LOG_THROW(expressionStructure.count("function")==1,storm::exceptions::InvalidJaniException,"Function call operator requires exactly one function (at "+scope.description+").");
std::stringfunctionName=getString(expressionStructure.at("function"),"in function call operator (at "+scope.description+").");
std::stringfunctionName=getString<ValueType>(expressionStructure.at("function"),"in function call operator (at "+scope.description+").");
STORM_LOG_THROW(locEntry.count("name")==1,storm::exceptions::InvalidJaniException,"Locations for automaton '"<<name<<"' must have exactly one name");
std::stringlocName=getString(locEntry.at("name"),"location of automaton "+name);
std::stringlocName=getString<ValueType>(locEntry.at("name"),"location of automaton "+name);
STORM_LOG_THROW(locIds.count(locName)==0,storm::exceptions::InvalidJaniException,"Location with name '"+locName+"' already exists in automaton '"+name+"'");
STORM_LOG_THROW(locEntry.count("invariant")==0,storm::exceptions::InvalidJaniException,"Invariants in locations as in '"+locName+"' in automaton '"+name+"' are not supported");
//STORM_LOG_THROW(locEntry.count("invariant") > 0 && !supportsInvariants(parentModel.getModelType()), storm::exceptions::InvalidJaniException, "Invariants are not supported in the model type " + to_string(parentModel.getModelType()));
@ -1400,8 +1429,8 @@ namespace storm {
locIds.emplace(locName,id);
}
STORM_LOG_THROW(automatonStructure.count("initial-locations")==1,storm::exceptions::InvalidJaniException,"Automaton '"<<name<<"' does not have initial locations.");
automaton.addInitialLocation(getString<ValueType>(initLocStruct,"Initial locations for automaton '"+name+"'."));
}
STORM_LOG_THROW(automatonStructure.count("restrict-initial")<2,storm::exceptions::InvalidJaniException,"Automaton '"<<name<<"' has multiple initial value restrictions");
STORM_LOG_THROW(edgeEntry.count("location")==1,storm::exceptions::InvalidJaniException,"Each edge in automaton '"<<name<<"' must have a source");
std::stringsourceLoc=getString(edgeEntry.at("location"),"source location for edge in automaton '"+name+"'");
std::stringsourceLoc=getString<ValueType>(edgeEntry.at("location"),"source location for edge in automaton '"+name+"'");
STORM_LOG_THROW(locIds.count(sourceLoc)==1,storm::exceptions::InvalidJaniException,"Source of edge has unknown location '"<<sourceLoc<<"' in automaton '"<<name<<"'.");
// action
STORM_LOG_THROW(edgeEntry.count("action")<2,storm::exceptions::InvalidJaniException,"Edge from "<<sourceLoc<<" in automaton "<<name<<" has multiple actions");
std::stringaction=storm::jani::Model::SILENT_ACTION_NAME;// def is tau
if(edgeEntry.count("action")>0){
action=getString(edgeEntry.at("action"),"action name in edge from '"+sourceLoc+"' in automaton '"+name+"'");
action=getString<ValueType>(edgeEntry.at("action"),"action name in edge from '"+sourceLoc+"' in automaton '"+name+"'");
// TODO check if action is known
assert(action!="");
}
@ -1460,7 +1489,7 @@ namespace storm {
// index
int64_tassignmentIndex=0;// default.
if(assignmentEntry.count("index")>0){
assignmentIndex=getSignedInt(assignmentEntry.at("index"),"assignment index in edge from '"+sourceLoc+"' in automaton '"+name+"'");
assignmentIndex=getSignedInt<ValueType>(assignmentEntry.at("index"),"assignment index in edge from '"+sourceLoc+"' in automaton '"+name+"'");
STORM_LOG_THROW(edgeEntry.count("location")==1,storm::exceptions::InvalidJaniException,"Each destination in edge from '"<<sourceLoc<<"' in automaton '"<<name<<"' must have a target location");
std::stringtargetLoc=getString(destEntry.at("location"),"target location for edge from '"+sourceLoc+"' in automaton '"+name+"'");
std::stringtargetLoc=getString<ValueType>(destEntry.at("location"),"target location for edge from '"+sourceLoc+"' in automaton '"+name+"'");
STORM_LOG_THROW(locIds.count(targetLoc)==1,storm::exceptions::InvalidJaniException,"Target of edge has unknown location '"<<targetLoc<<"' in automaton '"<<name<<"'.");
// probability
storm::expressions::ExpressionprobExpr;
@ -1502,7 +1531,7 @@ namespace storm {
// index
int64_tassignmentIndex=0;// default.
if(assignmentEntry.count("index")>0){
assignmentIndex=getSignedInt(assignmentEntry.at("index"),"assignment index in edge from '"+sourceLoc+"' to '"+targetLoc+"' in automaton '"+name+"'");
assignmentIndex=getSignedInt<ValueType>(assignmentEntry.at("index"),"assignment index in edge from '"+sourceLoc+"' to '"+targetLoc+"' in automaton '"+name+"'");
STORM_LOG_THROW(compositionStructure.count("elements")==1,storm::exceptions::InvalidJaniException,"Elements of a composition must be given, got "<<compositionStructure.dump());
@ -1564,11 +1595,13 @@ namespace storm {
STORM_LOG_THROW(compositionStructure.count("syncs")<2,storm::exceptions::InvalidJaniException,"Sync vectors can be given at most once");