this->addOption(storm::settings::OptionBuilder(moduleName,outputOptionName,true,"If set, the glpk output will be printed to the command line.").setIsAdvanced().build());
this->addOption(storm::settings::OptionBuilder(moduleName,integerToleranceOption,true,"Sets glpk's precision for integer variables.").setIsAdvanced().addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value","The precision to achieve.").setDefaultValueDouble(1e-06).addValidatorDouble(ArgumentValidatorFactory::createDoubleRangeValidatorExcluding(0.0,1.0)).build()).build());
// If the relaxed model is unbounded, there could still be no feasible integer solution.
// However, since we can not provide an optimal initial basis, we will need to enable presolving
if(glp_get_status(this->lp)==GLP_UNBND){
parameters->presolve=GLP_ON;
}else{
parameters->presolve=GLP_OFF;
}
}
// Invoke mip solving
error=glp_intopt(this->lp,parameters);
intstatus=glp_mip_status(this->lp);
deleteparameters;
// mipgap.first has been set to the achieved mipgap (either within the callback function or because it has been set to this->maxMILPGap)
this->actualRelativeMILPGap=mipgap.first;
// In case the error is caused by an infeasible problem, we do not want to view this as an error and
// reset the error code.
if(error==GLP_ENOPFS||status==GLP_NOFEAS){
this->isInfeasibleFlag=true;
error=0;
}elseif(error==GLP_ENODFS){
this->isUnboundedFlag=true;
error=0;
}elseif(error==GLP_ESTOP){
// Early termination due to achieved MIP Gap. That's fine.
error=0;
}elseif(error==GLP_EBOUND){
throwstorm::exceptions::InvalidStateException()<<"The bounds of some variables are illegal. Note that glpk only accepts integer bounds for integer variables.";
if(!this->isInfeasibleFlag){
// Check whether we allow sub-optimal solutions via a non-zero MIP gap.
// parameters->mip_gap = this->maxMILPGap; (only works for relative values. Also, we need to obtain the actual gap anyway.
// mipgap.first has been set to the achieved mipgap (either within the callback function or because it has been set to this->maxMILPGap)
this->actualRelativeMILPGap=mipgap.first;
// In case the error is caused by an infeasible problem, we do not want to view this as an error and
// reset the error code.
if(error==GLP_ENOPFS||status==GLP_NOFEAS){
this->isInfeasibleFlag=true;
error=0;
}elseif(error==GLP_ENODFS){
this->isUnboundedFlag=true;
error=0;
}elseif(error==GLP_ESTOP){
// Early termination due to achieved MIP Gap. That's fine.
error=0;
}elseif(error==GLP_EBOUND){
throwstorm::exceptions::InvalidStateException()<<"The bounds of some variables are illegal. Note that glpk only accepts integer bounds for integer variables.";