* adding settings MIPFocus (to switch between solving strategies) and ConcurrentMIP (to spawn multiple MIP solvers)
* allowing to set the desired and get the achieved gap between lower- and upper bound when solving MIP models
* retrieving other solutions found during optimization.
this->addOption(storm::settings::OptionBuilder(moduleName,threadsOption,true,"The number of threads that may be used by Gurobi.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count","The number of threads.").setDefaultValueUnsignedInteger(1).build()).build());
@ -22,6 +24,10 @@ namespace storm {
this->addOption(storm::settings::OptionBuilder(moduleName,outputOption,true,"If set, the Gurobi output will be printed to the command line.").build());
this->addOption(storm::settings::OptionBuilder(moduleName,integerToleranceOption,true,"Sets Gurobi's precision for integer variables.").addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value","The precision to achieve.").setDefaultValueDouble(1e-06).addValidatorDouble(ArgumentValidatorFactory::createDoubleRangeValidatorExcluding(0.0,1.0)).build()).build());
this->addOption(storm::settings::OptionBuilder(moduleName,mipFocusOption,true,"The high level solution strategy used to solve MILPs.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value","The number of the strategy.").setDefaultValueUnsignedInteger(0).addValidatorUnsignedInteger(ArgumentValidatorFactory::createUnsignedRangeValidatorIncluding(0,3)).build()).build());
this->addOption(storm::settings::OptionBuilder(moduleName,concurrentMipThreadsOption,true,"The number of MIP solvers Gurobi spawns in parallel. Shall not be larger then the number of threads.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value","The number of parallel solvers.").setDefaultValueUnsignedInteger(1).addValidatorUnsignedInteger(ArgumentValidatorFactory::createUnsignedGreaterEqualValidator(1)).build()).build());
STORM_LOG_WARN_COND(storm::settings::getModule<storm::settings::modules::CoreSettings>().getLpSolver()==storm::solver::LpSolverType::Gurobi,"Gurobi is not selected as the preferred LP solver, so setting options for Gurobi might have no effect.");
}
STORM_LOG_WARN_COND(getNumberOfConcurrentMipThreads()<=getNumberOfThreads(),"Requested more concurrent MILP solvers then the available threads for Gurobi.");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter Threads ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter MIPFocus ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter ConcurrentMIP ("<<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.
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter IntFeasTol ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi Parameter PoolSolutions ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(this->currentModelHasBeenOptimized,storm::exceptions::InvalidStateException,"Illegal call to GurobiLpSolver<ValueType>::getSolutionCount: model has not been optimized.");
intresult=-1;
interror=GRBgetintattr(model,"SolCount",&result);
STORM_LOG_THROW(error==0&&result>=0,storm::exceptions::InvalidStateException,"Unable to get solution count or invalid number of solutions.");
STORM_LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(variableIndexPair!=this->variableToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<variable.getName()<<"'.");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi solution index ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(variableIndexPair!=this->variableToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<variable.getName()<<"'.");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi solution index ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(std::abs(static_cast<int>(value)-value)<=storm::settings::getModule<storm::settings::modules::GurobiSettings>().getIntegerTolerance(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
STORM_LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(variableIndexPair!=this->variableToIndexMap.end(),storm::exceptions::InvalidAccessException,"Accessing value of unknown variable '"<<variable.getName()<<"'.");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi solution index ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
if(value>0.5){
STORM_LOG_THROW(std::abs(static_cast<int>(value)-1)<=storm::settings::getModule<storm::settings::modules::GurobiSettings>().getIntegerTolerance(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
}else{
STORM_LOG_THROW(value<=storm::settings::getModule<storm::settings::modules::GurobiSettings>().getIntegerTolerance(),storm::exceptions::InvalidStateException,"Illegal value for integer variable in Gurobi solution ("<<value<<").");
STORM_LOG_THROW(!this->isInfeasible(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from infeasible model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(!this->isUnbounded(),storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unbounded model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(false,storm::exceptions::InvalidAccessException,"Unable to get Gurobi solution from unoptimized model ("<<GRBgeterrormsg(env)<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi solution index ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi solution ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to set Gurobi MILP GAP ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
STORM_LOG_THROW(error==0,storm::exceptions::InvalidStateException,"Unable to get Gurobi MILP GAP ("<<GRBgeterrormsg(env)<<", error code "<<error<<").");
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 storm 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 storm 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 storm 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 storm 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 storm 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 storm 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 storm 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 storm with Gurobi support.";