29 #define PRESOL_NAME "implics" 30 #define PRESOL_DESC "implication graph aggregator" 31 #define PRESOL_PRIORITY -10000 32 #define PRESOL_MAXROUNDS -1 33 #define PRESOL_TIMING SCIP_PRESOLTIMING_MEDIUM 45 assert(presol != NULL);
72 assert(result != NULL);
99 for( v = 0; v < nbinvars; ++v )
114 for( varfixing = 0; varfixing < 2; ++varfixing )
125 while( i0 < nimpls[0] && i1 < nimpls[1] )
133 while( index0 < index1 )
136 if( i0 == nimpls[0] )
143 while( index1 < index0 )
146 if( i1 == nimpls[1] )
155 if( index0 == index1 )
158 assert(i0 < nimpls[0]);
159 assert(i1 < nimpls[1]);
160 assert(implvars[0][i0] == implvars[1][i1]);
162 if( impltypes[0][i0] == impltypes[1][i1] )
170 bdchgvars[nbdchgs] = implvars[0][i0];
171 bdchgtypes[nbdchgs] = impltypes[0][i0];
173 bdchgvals[nbdchgs] = MIN(implbounds[0][i0], implbounds[1][i1]);
175 bdchgvals[nbdchgs] =
MAX(implbounds[0][i0], implbounds[1][i1]);
177 SCIPdebugMsg(
scip,
" -> <%s> = 0 -> <%s> %s %g, and <%s> = 1 -> <%s> %s %g: tighten <%s> %s %g\n",
204 aggrvars[naggregations] = implvars[0][i0];
205 aggraggvars[naggregations] = vars[v];
206 aggrcoefs[naggregations] = implvarub - implvarlb;
207 aggrconsts[naggregations] = implvarlb;
209 SCIPdebugMsg(
scip,
" -> <%s> = 0 -> <%s> = %g, and <%s> = 1 -> <%s> = %g: aggregate <%s> = %g %+g<%s>\n",
212 SCIPvarGetName(aggrvars[naggregations]), aggrconsts[naggregations], aggrcoefs[naggregations],
226 aggrvars[naggregations] = implvars[0][i0];
227 aggraggvars[naggregations] = vars[v];
228 aggrcoefs[naggregations] = implvarlb - implvarub;
229 aggrconsts[naggregations] = implvarub;
231 SCIPdebugMsg(
scip,
" -> <%s> = 0 -> <%s> = %g, and <%s> = 1 -> <%s> = %g: aggregate <%s> = %g %+g<%s>\n",
234 SCIPvarGetName(aggrvars[naggregations]), aggrconsts[naggregations], aggrcoefs[naggregations],
255 for( v = 0; v < nbdchgs && *result !=
SCIP_CUTOFF; ++v )
260 assert(bdchgtypes != NULL);
261 assert(bdchgvars != NULL);
262 assert(bdchgvals != NULL);
291 for( v = 0; v < naggregations && *result !=
SCIP_CUTOFF; ++v )
297 assert(aggrvars != NULL);
298 assert(aggraggvars != NULL);
299 assert(aggrcoefs != NULL);
300 assert(aggrconsts != NULL);
304 &infeasible, &redundant, &aggregated) );
311 else if( aggregated )
345 assert(presolptr != NULL);
SCIP_RETCODE SCIPincludePresolBasic(SCIP *scip, SCIP_PRESOL **presolptr, const char *name, const char *desc, int priority, int maxrounds, SCIP_PRESOLTIMING timing, SCIP_DECL_PRESOLEXEC((*presolexec)), SCIP_PRESOLDATA *presoldata)
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define SCIPfreeBufferArrayNull(scip, ptr)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing)
implication graph presolver which checks for aggregations
int SCIPvarGetNImpls(SCIP_VAR *var, SCIP_Bool varfixing)
const char * SCIPpresolGetName(SCIP_PRESOL *presol)
SCIP_Real * SCIPvarGetImplBounds(SCIP_VAR *var, SCIP_Bool varfixing)
int SCIPgetNBinVars(SCIP *scip)
SCIP_VAR ** SCIPvarGetImplVars(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_RETCODE SCIPsetPresolCopy(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLCOPY((*presolcopy)))
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_RETCODE SCIPaggregateVars(SCIP *scip, SCIP_VAR *varx, SCIP_VAR *vary, SCIP_Real scalarx, SCIP_Real scalary, SCIP_Real rhs, SCIP_Bool *infeasible, SCIP_Bool *redundant, SCIP_Bool *aggregated)
int SCIPvarGetIndex(SCIP_VAR *var)
static SCIP_DECL_PRESOLCOPY(presolCopyImplics)
SCIP_Bool SCIPvarIsDeleted(SCIP_VAR *var)
static SCIP_DECL_PRESOLEXEC(presolExecImplics)
SCIP_RETCODE SCIPincludePresolImplics(SCIP *scip)
#define SCIPreallocBufferArray(scip, ptr, num)