instance->addOption(storm::settings::OptionBuilder("GmmxxLinearEquationSolver","digiprecision","","Precision used for iterative solving of linear equation systems").addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("precision value","Precision").setDefaultValueDouble(1e-4).addValidationFunctionDouble(storm::settings::ArgumentValidators::doubleRangeValidatorExcluding(0.0,1.0)).build()).build());
instance->addOption(storm::settings::OptionBuilder("GlpkLpSolver","glpkoutput","","If set, the glpk output will be printed to the command line.").build());
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG4CPLUS_ERROR(logger,"Illegal value for binary variable in Gurobi solution ("<<value<<").");
throwstorm::exceptions::InvalidStateException()<<"Illegal value for binary variable in Gurobi solution ("<<value<<").";
}
// Now check the desired precision was actually achieved.
LOG_THROW(std::abs(static_cast<int>(value)-value)<=storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in glpk solution ("<<value<<").");
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG_THROW(std::abs(static_cast<int>(value)-value)<=storm::settings::Settings::getInstance()->getOptionByLongName("glpkinttol").getArgument(0).getValueAsDouble(),storm::exceptions::InvalidStateException,"Illegal value for binary variable in glpk solution ("<<value<<").");
returnstatic_cast<bool>(value);
}
doubleGlpkLpSolver::getObjectiveValue()const{
if(!this->isOptimal()){
if(this->isInfeasible()){
LOG4CPLUS_ERROR(logger,"Unable to get glpk solution from infeasible model.");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from infeasible model.";
}elseif(this->isUnbounded()){
LOG4CPLUS_ERROR(logger,"Unable to get glpk solution from unbounded model.");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unbounded model.";
}else{
LOG4CPLUS_ERROR(logger,"Unable to get glpk solution from unoptimized model.");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unoptimized model.";
}
LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get glpk solution from infeasible model.");
LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get glpk solution from unbounded model.");
LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get glpk solution from unoptimized model.");
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
}
@ -137,14 +192,14 @@ namespace storm {
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
}
virtualvoidoptimize()constoverride{
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
}
virtualboolisInfeasible()constoverride{
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
}
@ -157,15 +212,15 @@ namespace storm {
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for glpk. Yet, a method was called that requires this support. Please choose a version of support with glpk support.";
instance->addOption(storm::settings::OptionBuilder("GurobiLpSolver","gurobithreads","","The number of threads that may be used by Gurobi.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count","The number of threads.").setDefaultValueUnsignedInteger(1).build()).build());
LOG4CPLUS_ERROR(logger,"Unable to set Gurobi Parameter OutputFlag ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to set Gurobi Parameter OutputFlag ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter OutputFlag ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
// Enable the following line to restrict Gurobi to one thread only.
LOG4CPLUS_ERROR(logger,"Unable to set Gurobi Parameter Threads ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to set Gurobi Parameter Threads ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter Threads ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
// Enable the following line to force Gurobi to be as precise about the binary variables as required by the given precision option.
LOG4CPLUS_ERROR(logger,"Unable to set Gurobi Parameter IntFeasTol ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to set Gurobi Parameter IntFeasTol ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter IntFeasTol ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
}
voidGurobiLpSolver::update()const{
interror=GRBupdatemodel(model);
if(error){
LOG4CPLUS_ERROR(logger,"Unable to update Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to update Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to update Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
// Since the model changed, we erase the optimality flag.
// As Gurobi requires the indices to be unique, we now explicitly make them unique. For this, we sort the
// variables and coefficients and eliminated duplicates by adding the coefficients.
// Check for valid variable type.
LOG_ASSERT(variableType==GRB_CONTINUOUS||variableType==GRB_INTEGER||variableType==GRB_BINARY,"Illegal type '"<<variableType<<"' for Gurobi variable.");
LOG4CPLUS_ERROR(logger,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
// By default, Gurobi may tell us only that the model is either infeasible or unbounded. To decide which one
LOG4CPLUS_ERROR(logger,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
LOG4CPLUS_ERROR(logger,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
// By default, Gurobi may tell us only that the model is either infeasible or unbounded. To decide which one
LOG4CPLUS_ERROR(logger,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
LOG4CPLUS_ERROR(logger,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
}
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to retrieve optimization status of Gurobi model ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").";
}elseif(this->isUnbounded()){
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").";
}else{
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").";
}
LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").";
LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
LOG_THROW(std::abs(static_cast<int>(value)-value)<=storm::settings::Settings::getInstance()->getOptionByLongName("gurobiinttol").getArgument(0).getValueAsDouble(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").";
}elseif(this->isUnbounded()){
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").";
}else{
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").";
}
LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(variableIndexPair!=this->variableNameToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<name<<"'.");
LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
if(value>0.5){
LOG_THROW(std::abs(static_cast<int>(value)-1)<=storm::settings::Settings::getInstance()->getOptionByLongName("gurobiinttol").getArgument(0).getValueAsDouble(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
}else{
LOG_THROW(value<=storm::settings::Settings::getInstance()->getOptionByLongName("gurobiinttol").getArgument(0).getValueAsDouble(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
}
returnvalue;
returnstatic_cast<bool>(value);
}
doubleGurobiLpSolver::getObjectiveValue()const{
if(!this->isOptimal()){
if(this->isInfeasible()){
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").";
}elseif(this->isUnbounded()){
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").";
}else{
LOG4CPLUS_ERROR(logger,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::InvalidStateException()<<"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").";
}
LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";}
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
}
@ -154,15 +204,15 @@ namespace storm {
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
throwstorm::exceptions::NotImplementedException()<<"This version of StoRM was compiled without support for Gurobi. Yet, a method was called that requires this support. Please choose a version of support with Gurobi support.";
// If the expression is linear, either the left or the right side must not contain variables.
LOG_THROW(leftResult.first.getNumberOfIdentifiers()==0||rightResult.first.getNumberOfIdentifiers()==0,storm::exceptions::InvalidArgumentException,"Expression is non-linear.");
// If the expression is linear, either the left or the right side must not contain variables.
LOG_THROW(leftResult.first.getNumberOfIdentifiers()==0||rightResult.first.getNumberOfIdentifiers()==0,storm::exceptions::InvalidArgumentException,"Expression is non-linear.");
xxxxxxxxxx