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,"Unsupported type "<<typeStructure.dump()<<" for variable '"<<name<<"' (scope: "<<scopeDescription<<")");
}
}elseif(typeStructure.is_object()){
STORM_LOG_THROW(typeStructure.count("kind")==1,storm::exceptions::InvalidJaniException,"For complex type as in variable "<<variableName<<"(scope: "<<scopeDescription<<") kind must be given");
std::stringkind=getString(typeStructure.at("kind"),"kind for complex type as in variable "+variableName+"(scope: "+scopeDescription+") ");
if(kind=="bounded"){
STORM_LOG_THROW(typeStructure.count("lower-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<variableName<<"(scope: "<<scopeDescription<<") lower-bound must be given");
storm::expressions::ExpressionlowerboundExpr=parseExpression(typeStructure.at("lower-bound"),"Lower bound for variable "+variableName+" (scope: "+scopeDescription+")",globalVars,constants,localVars);
assert(lowerboundExpr.isInitialized());
STORM_LOG_THROW(typeStructure.count("upper-bound")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<variableName<<"(scope: "<<scopeDescription<<") upper-bound must be given");
storm::expressions::ExpressionupperboundExpr=parseExpression(typeStructure.at("upper-bound"),"Upper bound for variable "+variableName+" (scope: "+scopeDescription+")",globalVars,constants,localVars);
assert(upperboundExpr.isInitialized());
STORM_LOG_THROW(typeStructure.count("base")==1,storm::exceptions::InvalidJaniException,"For bounded type as in variable "<<variableName<<"(scope: "<<scopeDescription<<") base must be given");
std::stringbasictype=getString(typeStructure.at("base"),"base for bounded type as in variable "+variableName+"(scope: "+scopeDescription+") ");
if(basictype=="int"){
STORM_LOG_THROW(lowerboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Lower bound for bounded integer variable "<<variableName<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(upperboundExpr.hasIntegerType(),storm::exceptions::InvalidJaniException,"Upper bound for bounded integer variable "<<variableName<<"(scope: "<<scopeDescription<<") must be integer-typed");
STORM_LOG_THROW(lowerboundExpr.evaluateAsInt()<=upperboundExpr.evaluateAsInt(),storm::exceptions::InvalidJaniException,"Lower bound must not be larger than upper bound for bounded integer variable "<<variableName<<"(scope: "<<scopeDescription<<")");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported base "<<basictype<<" for bounded variable "<<variableName<<"(scope: "<<scopeDescription<<") ");
}
}elseif(kind=="array"){
STORM_LOG_THROW(typeStructure.count("base")==1,storm::exceptions::InvalidJaniException,"For array type as in variable "<<variableName<<"(scope: "<<scopeDescription<<") base must be given");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported kind "<<kind<<" for complex type of variable "<<name<<"(scope: "<<scopeDescription<<") ");
std::stringname=getString(variableStructure.at("name"),"variable-name in "+scopeDescription+"-scope");
@ -640,101 +687,103 @@ namespace storm {
if(tvarcount==1){
transientVar=getBoolean(variableStructure.at("transient"),"transient-attribute in variable '"+name+"' (scope: "+scopeDescription+") ");
}
STORM_LOG_THROW(variableStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Variable '"+name+"' (scope: "+scopeDescription+") must have a (single) type-declaration.");
STORM_LOG_THROW(initvalcount==1,storm::exceptions::InvalidJaniException,"Initial value must be given once for transient variable '"+name+"' (scope: "+scopeDescription+") "+name+"' (scope: "+scopeDescription+") ");
}else{
STORM_LOG_THROW(initvalcount<=1,storm::exceptions::InvalidJaniException,"Initial value can be given at most one for variable "+name+"' (scope: "+scopeDescription+")");
}
STORM_LOG_THROW(variableStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Variable '"+name+"' (scope: "+scopeDescription+") must have a (single) type-declaration.");
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ",globalVars,constants,localVars);
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ",globalVars,constants,localVars);
STORM_LOG_THROW(initVal.get().hasRationalType()||initVal.get().hasIntegerType(),storm::exceptions::InvalidJaniException,"Initial value for rational variable "+name+"(scope "+scopeDescription+") should be a rational");
STORM_LOG_THROW(initVal.get().hasRationalType()||initVal.get().hasIntegerType(),storm::exceptions::InvalidJaniException,"Initial value for rational variable "+name+"(scope "+scopeDescription+") should be a rational");
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ",globalVars,constants,localVars);
STORM_LOG_THROW(initVal.get().hasBooleanType(),storm::exceptions::InvalidJaniException,"Initial value for boolean variable "+name+"(scope "+scopeDescription+") should be a Boolean");
initVal=parseExpression(variableStructure.at("initial-value"),"Initial value for variable "+name+" (scope: "+scopeDescription+") ",globalVars,constants,localVars);
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(false,storm::exceptions::InvalidJaniException,"Unsupported type 'continuous' for variable ''"<<name<<"' (scope: "<<scopeDescription<<")");
}else{
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+")",globalVars,constants,localVars);
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+")",globalVars,constants,localVars);
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+") ",globalVars,constants,localVars);
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(lowerboundExpr.evaluateAsInt()<=upperboundExpr.evaluateAsInt(),storm::exceptions::InvalidJaniException,"Lower bound must not be larger than upper bound for bounded integer variable "<<name<<"(scope: "<<scopeDescription<<")");
if(initVal){
STORM_LOG_THROW(initVal.get().hasBooleanType(),storm::exceptions::InvalidJaniException,"Initial value for boolean variable "+name+"(scope "+scopeDescription+") should be a Boolean");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported base "<<basictype<<" for bounded variable "<<name<<"(scope: "<<scopeDescription<<") ");
}
}
}elseif(type.arrayBase){
STORM_LOG_THROW(type.arrayBase->basicType,storm::exceptions::InvalidJaniException,"Array base type for variable "+name+"(scope "+scopeDescription+") should be a BasicType or a BoundedType.");
STORM_LOG_THROW(initVal.get().hasArrayType(),storm::exceptions::InvalidJaniException,"Initial value for array variable "+name+"(scope "+scopeDescription+") should be an Array");
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<<")");
}
@ -1050,8 +1099,9 @@ namespace storm {
STORM_LOG_THROW(varDeclCount<2,storm::exceptions::InvalidJaniException,"Automaton '"<<name<<"' has more than one list of variables");