STORM_LOG_THROW(constantStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Constant '"+name+"' (scope: "+scope.description+") must have a (single) type-declaration.");
STORM_LOG_THROW(valueCount<2,storm::exceptions::InvalidJaniException,"Value for constant '"+name+"' (scope: "+scope.description+") must be given at most once.");
if(valueCount==1){
// Read initial value before; that makes creation later on a bit easier, and has as an additional benefit that we do not need to check whether the variable occurs also on the assignment.
initExpr=parseExpression(constantStructure.at("value"),scope.refine("Value of constant "+name));
assert(initExpr.isInitialized());
definingExpression=parseExpression(constantStructure.at("value"),scope.refine("Value of constant "+name));
assert(definingExpression.isInitialized());
}
if(constantStructure.at("type").is_object()){
// STORM_LOG_THROW(variableStructure.at("type").count("kind") == 1, storm::exceptions::InvalidJaniException, "For complex type as in variable " << name << "(scope: " << scope.description << ") kind must be given");
// std::string kind = getString(variableStructure.at("type").at("kind"), "kind for complex type as in variable " + name + "(scope: " + scope.description + ") ");
// 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: " << scope.description << ") lower-bound must be given");
// storm::expressions::Expression lowerboundExpr = parseExpression(variableStructure.at("type").at("lower-bound"), "Lower bound for variable "+ name + " (scope: " + scope.description + ")");
// assert(lowerboundExpr.isInitialized());
// STORM_LOG_THROW(variableStructure.at("type").count("upper-bound") == 1, storm::exceptions::InvalidJaniException, "For bounded type as in variable " << name << "(scope: " << scope.description << ") upper-bound must be given");
// storm::expressions::Expression upperboundExpr = parseExpression(variableStructure.at("type").at("upper-bound"), "Upper bound for variable "+ name + " (scope: " + scope.description + ")");
// assert(upperboundExpr.isInitialized());
// STORM_LOG_THROW(variableStructure.at("type").count("base") == 1, storm::exceptions::InvalidJaniException, "For bounded type as in variable " << name << "(scope: " << scope.description << ") base must be given");
// std::string basictype = getString(variableStructure.at("type").at("base"), "base for bounded type as in variable " + name + "(scope: " + scope.description + ") ");
// if(basictype == "int") {
// STORM_LOG_THROW(lowerboundExpr.hasIntegerType(), storm::exceptions::InvalidJaniException, "Lower bound for bounded integer variable " << name << "(scope: " << scope.description << ") must be integer-typed");
// STORM_LOG_THROW(upperboundExpr.hasIntegerType(), storm::exceptions::InvalidJaniException, "Upper bound for bounded integer variable " << name << "(scope: " << scope.description << ") must be integer-typed");
STORM_LOG_THROW(constantStructure.count("type")==1,storm::exceptions::InvalidJaniException,"Constant '"+name+"' (scope: "+scope.description+") must have a (single) type-declaration.");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description "<<constantStructure.at("type").dump()<<" for constant '"<<name<<"' (scope: "<<scope.description<<")");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unknown type description, "<<constantStructure.at("type").dump()<<" for Variable '"<<name<<"' (scope: "<<scope.description<<")");
STORM_LOG_THROW(!lowerboundExpr.isInitialized()||lowerboundExpr.hasNumericalType(),storm::exceptions::InvalidJaniException,"Lower bound for bounded real variable "<<variableName<<"(scope: "<<scope.description<<") must be numeric");
STORM_LOG_THROW(!upperboundExpr.isInitialized()||upperboundExpr.hasNumericalType(),storm::exceptions::InvalidJaniException,"Upper bound for bounded real variable "<<variableName<<"(scope: "<<scope.description<<") must be numeric");
STORM_LOG_THROW(lowerboundExpr.evaluateAsRational()<=upperboundExpr.evaluateAsRational(),storm::exceptions::InvalidJaniException,"Lower bound must not be larger than upper bound for bounded integer variable "<<variableName<<"(scope: "<<scope.description<<")");
STORM_LOG_THROW(false,storm::exceptions::InvalidJaniException,"Unsupported base "<<basictype<<" for bounded variable "<<variableName<<"(scope: "<<scope.description<<") ");
}
@ -835,6 +822,7 @@ namespace storm {
if(type.basicType){
switch(type.basicType.get()){
caseParsedType::BasicType::Real:
STORM_LOG_WARN_COND(!type.bounds.is_initialized(),"Bounds for rational variable "+name+"(scope "+scope.description+") will be ignored.");
STORM_LOG_THROW(checkDefiningExpression(variable,definingExpression,constraintExpression),storm::exceptions::InvalidJaniException,"The constant '"<<name<<"' was set to '"<<definingExpression<<"' which violates the constraint given for this constant: '"<<constraintExpression<<"'.");
STORM_LOG_THROW(checkDefiningExpression(getExpressionVariable(),expression,constraintExpression),storm::exceptions::InvalidJaniException,"The constant '"<<name<<"' was set to '"<<expression<<"' which violates the constraint given for this constant: '"<<constraintExpression<<"'.");
STORM_LOG_THROW(checkDefiningExpression(getExpressionVariable(),definingExpression,expression),storm::exceptions::InvalidJaniException,"The constant '"<<name<<"' was set to '"<<definingExpression<<"' which violates the constraint given for this constant: '"<<expression<<"'.");