STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description "<<constantStructure.at("type").dump()<<" for Variable '"<<name<<"' (scope: "<<scopeDescription<<")");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description "<<constantStructure.at("type").dump()<<" for constant '"<<name<<"' (scope: "<<scopeDescription<<")");
}
}
@ -217,52 +221,27 @@ namespace storm {
}
STORM_LOG_THROW(variableStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Variable '"+name+"' (scope: "+scopeDescription+") must have a (single) type-declaration.");
STORM_LOG_THROW(variableStructure.at("type").count("kind")==1,storm::exceptions::InvalidJaniException,"For complex type as in variable "<<name<<"(scope: "<<scopeDescription<<") kind must be given");
std::stringkind=getString(variableStructure.at("type").at("kind"),"kind for complex type as in variable "+name+"(scope: "+scopeDescription+") ");
if(kind=="bounded"){
// First do the bounds, that makes the code a bit more streamlined
STORM_LOG_THROW(variableStructure.at("type").count("lower-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") lower-bound must be given");
storm::expressions::ExpressionlowerboundExpr=parseExpression(variableStructure.at("type").at("lower-bound"),"Lower bound for variable "+name+" (scope: "+scopeDescription+")");
assert(lowerboundExpr.isInitialized());
STORM_LOG_THROW(variableStructure.at("type").count("upper-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") upper-bound must be given");
storm::expressions::ExpressionupperboundExpr=parseExpression(variableStructure.at("type").at("upper-bound"),"Upper bound for variable "+name+" (scope: "+scopeDescription+")");
assert(upperboundExpr.isInitialized());
STORM_LOG_THROW(variableStructure.at("type").count("base")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") base must be given");
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ");
STORM_LOG_THROW(initVal.get().hasRationalType(),storm::exceptions::InvalidJaniException,"Initial value for integer variable "+name+"(scope "+scopeDescription+") should be a rational");
std::stringbasictype=getString(variableStructure.at("type").at("base"),"base for bounded type as in variable "+name+"(scope: "+scopeDescription+") ");
if(basictype=="int"){
if(initVal){
STORM_LOG_THROW(initVal.get().hasIntegerType(),storm::exceptions::InvalidJaniException,"Initial value for integer variable "+name+"(scope "+scopeDescription+") should be an integer");
}
STORM_LOG_THROW(lowerboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Lower bound for bounded integer variable "<<name<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(upperboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Upper bound for bounded integer variable "<<name<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported base "<<basictype<<" for bounded variable "<<name<<"(scope: "<<scopeDescription<<") ");
}
}else{
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported kind "<<kind<<" for complex type of variable "<<name<<"(scope: "<<scopeDescription<<") ");
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ");
STORM_LOG_THROW(initVal.get().hasIntegerType(),storm::exceptions::InvalidJaniException,"Initial value for integer variable "+name+"(scope "+scopeDescription+") should be a Boolean");
STORM_LOG_THROW(initVal.get().hasBooleanType(),storm::exceptions::InvalidJaniException,"Initial value for integer variable "+name+"(scope "+scopeDescription+") should be a Boolean");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description "<<variableStructure.at("type").dump()<<" for variable '"<<name<<"' (scope: "<<scopeDescription<<")");
STORM_LOG_THROW(variableStructure.at("type").count("kind")==1,storm::exceptions::InvalidJaniException,"For complex type as in variable "<<name<<"(scope: "<<scopeDescription<<") kind must be given");
std::stringkind=getString(variableStructure.at("type").at("kind"),"kind for complex type as in variable "+name+"(scope: "+scopeDescription+") ");
if(kind=="bounded"){
// First do the bounds, that makes the code a bit more streamlined
STORM_LOG_THROW(variableStructure.at("type").count("lower-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") lower-bound must be given");
storm::expressions::ExpressionlowerboundExpr=parseExpression(variableStructure.at("type").at("lower-bound"),"Lower bound for variable "+name+" (scope: "+scopeDescription+")");
assert(lowerboundExpr.isInitialized());
STORM_LOG_THROW(variableStructure.at("type").count("upper-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") upper-bound must be given");
storm::expressions::ExpressionupperboundExpr=parseExpression(variableStructure.at("type").at("upper-bound"),"Upper bound for variable "+name+" (scope: "+scopeDescription+")");
assert(upperboundExpr.isInitialized());
STORM_LOG_THROW(variableStructure.at("type").count("base")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<name<<"(scope: "<<scopeDescription<<") base must be given");
// TODO as soon as we support half-open intervals, we have to change this.
}else{
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ");
}
}
std::stringbasictype=getString(variableStructure.at("type").at("base"),"base for bounded type as in variable "+name+"(scope: "+scopeDescription+") ");
if(basictype=="int"){
if(initVal){
STORM_LOG_THROW(initVal.get().hasIntegerType(),storm::exceptions::InvalidJaniException,"Initial value for integer variable "+name+"(scope "+scopeDescription+") should be an integer");
}
STORM_LOG_THROW(lowerboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Lower bound for bounded integer variable "<<name<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(upperboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Upper bound for bounded integer variable "<<name<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported base "<<basictype<<" for bounded variable "<<name<<"(scope: "<<scopeDescription<<") ");
}
}else{
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported kind "<<kind<<" for complex type of variable "<<name<<"(scope: "<<scopeDescription<<") ");
}
}
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description, "<<variableStructure.at("type").dump()<<" for variable '"<<name<<"' (scope: "<<scopeDescription<<")");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown operator "<<opstring<<" in "<<scopeDescription<<".");
}
}
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Only standard operators are supported for complex expressions as "<<expressionStructure.dump()<<" in "<<scopeDescription<<".");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"No supported operator declaration found for complex expressions as "<<expressionStructure.dump()<<" in "<<scopeDescription<<".");
}
assert(false);
@ -564,7 +577,7 @@ namespace storm {
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);
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+"' are not supported");
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()));
STORM_LOG_THROW(automatonStructure.count("restrict-initial")<2,storm::exceptions::InvalidJaniException,"Automaton '"<<name<<"' has multiple initial value restrictions");
initialValueRestriction=parseExpression(automatonStructure.at("restrict-initial"),"Initial value restriction for automaton "+name);
STORM_LOG_THROW(automatonStructure.at("restrict-initial").count("exp")==1,storm::exceptions::InvalidJaniException,"Automaton '"<<name<<"' needs an expression inside the initial restricion");
initialValueRestriction=parseExpression(automatonStructure.at("restrict-initial").at("exp"),"Initial value restriction for automaton "+name);
STORM_LOG_THROW(destEntry.at("probability").count("exp")==1,storm::exceptions::InvalidJaniException,"Destination in edge from '"<<sourceLoc<<"' to '"<<targetLoc<<"' in automaton '"<<name<<"' must have one expression.");
STORM_LOG_THROW(destEntry.at("probability").count("exp")==1,storm::exceptions::InvalidJaniException,"Destination in edge from '"<<sourceLoc<<"' to '"<<targetLoc<<"' in automaton '"<<name<<"' must have a probability expression.");
probExpr=parseExpression(destEntry.at("probability").at("exp"),"probability expression in edge from '"+sourceLoc+"' to '"+targetLoc+"' in automaton '"+name+"'",localVars);