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("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("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)<<").");