LOG_THROW(!globalProgramInformation.hasInitialStatesExpression,storm::exceptions::InvalidArgumentException,"Program must not define two initial constructs.");
LOG_THROW(!globalProgramInformation.hasInitialConstruct,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Program must not define two initial constructs.");
LOG_THROW(expression!=nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Undeclared identifier '"<<identifier<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(newConstant)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<newConstant<<"'.");
LOG_THROW(this->identifiers_.find(formulaName)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<formulaName<<"'.");
LOG_THROW(this->identifiers_.find(variableName)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<variableName<<"'.");
LOG_THROW(this->identifiers_.find(variableName)==nullptr,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Duplicate identifier '"<<variableName<<"'.");
LOG_THROW(moduleIndexPair!=globalProgramInformation.moduleToIndexMap.end(),storm::exceptions::WrongFormatException,"No module named '"<<oldModuleName<<"' to rename.");
LOG_THROW(moduleIndexPair!=globalProgramInformation.moduleToIndexMap.end(),storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": No module named '"<<oldModuleName<<"' to rename.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Boolean variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Boolean variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Integer variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Integer variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Boolean variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Boolean variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Integer variable '"<<variable.getName()<<" was not renamed.");
LOG_THROW(renamingPair!=renaming.end(),storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Integer variable '"<<variable.getName()<<" was not renamed.");
//LOG4CPLUS_ERROR(logger,"Error: expecting "<<what<<" in line "<<get_line(where)<<" at column "<<get_column(b,where,4)<<".");
std::cerr<<"Error: expecting "<<what<<" in line "<<get_line(where)<<"."<<std::endl;
T3end(where);
while(end!=e&&*end!='\r'&&*end!='\n'){
++end;
}
std::cerr<<"Error: expecting "<<what<<" in line "<<get_line(where)<<": \n"<<std::string(get_line_start(b,where),end)<<" ... \n"<<std::setw(std::distance(b,where))<<'^'<<"---- here\n";
LOG_THROW(false,storm::exceptions::WrongFormatException,"Parsing error in line "<<get_line(where)<<": "<<" expecting "<<what<<".");
// Set up options for precision and maximal memory available to Cudd.
instance->addOption(storm::settings::OptionBuilder("Cudd","cuddprec","","Sets the precision used by Cudd.").addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value","The precision up to which to constants are considered to be different.").setDefaultValueDouble(1e-15).addValidationFunctionDouble(storm::settings::ArgumentValidators::doubleRangeValidatorExcluding(0.0,1.0)).build()).build());
instance->addOption(storm::settings::OptionBuilder("Cudd","cuddmaxmem","","Sets the upper bound of memory available to Cudd in MB.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("mb","The memory available to Cudd (0 means unlimited).").setDefaultValueUnsignedInteger(2048).build()).build());
// Set up option for reordering.
std::vector<std::string>reorderingTechniques;
reorderingTechniques.push_back("none");
reorderingTechniques.push_back("sift");
reorderingTechniques.push_back("ssift");
reorderingTechniques.push_back("gsift");
reorderingTechniques.push_back("win2");
reorderingTechniques.push_back("win3");
reorderingTechniques.push_back("win4");
reorderingTechniques.push_back("annealing");
reorderingTechniques.push_back("genetic");
reorderingTechniques.push_back("exact");
instance->addOption(storm::settings::OptionBuilder("Cudd","reorder","","Sets the reordering technique used by Cudd.").addArgument(storm::settings::ArgumentBuilder::createStringArgument("method","Sets which technique is used by Cudd's reordering routines. Must be in {\"none\", \"sift\", \"ssift\", \"gsift\", \"win2\", \"win3\", \"win4\", \"annealing\", \"genetic\", \"exact\"}.").setDefaultValueString("gsift").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(reorderingTechniques)).build()).build());
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'bool', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Double,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'double', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Int,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'int', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getVariableName()<<"'.");
LOG_THROW(identifierTypePair->second==expression->getReturnType(),storm::exceptions::InvalidTypeException,"Type mismatch for variable '"<<expression->getVariableName()<<"': expected '"<<identifierTypePair->first<<"', but found '"<<expression->getReturnType()<<"'.");
// Initialize the internal mappings for fast information retrieval.
this->createMappings();
}
@ -71,6 +76,20 @@ namespace storm {
returnactionEntry!=this->actions.end();
}
boolModule::isRenamedFromModule()const{
returnthis->renamedFromModule!="";
}
std::stringconst&Module::getBaseModule()const{
LOG_THROW(this->isRenamedFromModule(),storm::exceptions::InvalidAccessException,"Unable to retrieve base module of module that was not created by renaming.");
LOG_THROW(this->isRenamedFromModule(),storm::exceptions::InvalidAccessException,"Unable to retrieve renaming of module that was not created by renaming.");
LOG_THROW(definedUndefinedConstants.find(constantExpressionPair.first)!=definedUndefinedConstants.end(),storm::exceptions::InvalidArgumentException,"Unable to define non-existant constant.");
LOG_THROW(allIdentifiers.find(constant.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<constant.getFilename()<<", line "<<constant.getLineNumber()<<": duplicate identifier '"<<constant.getName()<<"'.");
// Check defining expressions of defined constants.
if(constant.isDefined()){
LOG_THROW(constant.getExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<constant.getFilename()<<", line "<<constant.getLineNumber()<<": definition of constant "<<constant.getName()<<" must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<constant.getFilename()<<", line "<<constant.getLineNumber()<<": defining expression refers to unknown constants.");
// Now check that the constants appear with the right types.
LOG_THROW(allIdentifiers.find(variable.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": duplicate identifier '"<<variable.getName()<<"'.");
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(allIdentifiers.find(variable.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": duplicate identifier '"<<variable.getName()<<"'.");
// Check that bound expressions of the range.
LOG_THROW(variable.getLowerBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
LOG_THROW(variable.getUpperBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(allIdentifiers.find(variable.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": duplicate identifier '"<<variable.getName()<<"'.");
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(allIdentifiers.find(variable.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": duplicate identifier '"<<variable.getName()<<"'.");
// Register the type of the constant for later type checks.
LOG_THROW(variable.getLowerBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
LOG_THROW(variable.getUpperBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": guard refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": "<<e.what());
}
LOG_THROW(command.getGuardExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": expression for guard must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": likelihood expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": assignment illegally refers to variable '"<<assignment.getVariableName()<<"'.");
}else{
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": assignment refers to unknown variable '"<<assignment.getVariableName()<<"'.");
}
}
LOG_THROW(alreadyAssignedIdentifiers.find(assignment.getVariableName())==alreadyAssignedIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": duplicate assignment to variable '"<<assignment.getVariableName()<<"'.");
LOG_THROW(variableTypePair->second==assignment.getExpression().getReturnType(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": illegally assigning a value of type '"<<assignment.getExpression().getReturnType()<<"' to variable '"<<variableTypePair->first<<"' of type '"<<variableTypePair->second<<"'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": likelihood expression refers to unknown identifiers.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state reward expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(stateReward.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state predicate must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state reward value expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(stateReward.getRewardValueExpression().hasNumericalReturnType(),storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": reward value expression must evaluate to numerical type.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state reward expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(transitionReward.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state predicate must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state reward value expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(transitionReward.getRewardValueExpression().hasNumericalReturnType(),storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": reward value expression must evaluate to numerical type.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<this->getInitialConstruct().getFilename()<<", line "<<this->getInitialConstruct().getLineNumber()<<": initial expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<this->getInitialConstruct().getFilename()<<", line "<<this->getInitialConstruct().getLineNumber()<<": "<<e.what());
}
// Check the labels.
for(autoconst&label:this->getLabels()){
// Check for duplicate identifiers.
LOG_THROW(allIdentifiers.find(label.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": duplicate identifier '"<<label.getName()<<"'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": label expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": "<<e.what());
}
LOG_THROW(label.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": label predicate must evaluate to type 'bool'.");
}
// Check the formulas.
for(autoconst&formula:this->getFormulas()){
// Check for duplicate identifiers.
LOG_THROW(allIdentifiers.find(formula.getName())==allIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<formula.getFilename()<<", line "<<formula.getLineNumber()<<": duplicate identifier '"<<formula.getName()<<"'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<formula.getFilename()<<", line "<<formula.getLineNumber()<<": formula expression refers to unknown identifiers.");