60 #define PROP_NAME "sdpredcost" 61 #define PROP_DESC "sdp reduced cost strengthening propagator" 62 #define PROP_TIMING SCIP_PROPTIMING_AFTERLPLOOP 63 #define PROP_PRIORITY +1000000 65 #define PROP_DELAY FALSE 67 #define DEFAULT_SDPRCBIN TRUE 68 #define DEFAULT_SDPRCINTCONT TRUE 80 SCIP_Bool forintconts;
93 SCIP_Real primallbval,
94 SCIP_Real primalubval,
95 SCIP_Real cutoffbound,
100 assert( scip != NULL );
101 assert( var != NULL );
102 assert( result != NULL );
103 assert( ! SCIPisInfinity(scip, REALABS(cutoffbound)) );
104 assert( ! SCIPisInfinity(scip, REALABS(relaxval)) );
105 assert( SCIPisFeasGE(scip, cutoffbound, relaxval) );
107 *result = SCIP_DIDNOTFIND;
110 if ( SCIPvarGetLbLocal(var) > 0.5 || SCIPvarGetUbLocal(var) < 0.5 )
114 if ( SCIPisGT(scip, primallbval, cutoffbound - relaxval) )
116 SCIPdebugMsg(scip,
"Variable <%s> fixed to zero.\n", SCIPvarGetName(var));
117 SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
118 *result = SCIP_REDUCEDDOM;
121 if ( SCIPisGT(scip, primalubval, cutoffbound - relaxval) )
122 *result = SCIP_CUTOFF;
128 if ( SCIPisGT(scip, primalubval, cutoffbound - relaxval) )
130 SCIPdebugMsg(scip,
"Variable <%s> fixed to one.\n", SCIPvarGetName(var));
131 SCIP_CALL( SCIPchgVarLb(scip, var, 1.0) );
132 *result = SCIP_REDUCEDDOM;
154 SCIP_Real primallbval,
155 SCIP_Real primalubval,
156 SCIP_Real cutoffbound,
166 assert( scip != NULL );
167 assert( var != NULL );
168 assert( result != NULL );
169 assert( ! SCIPisInfinity(scip, REALABS(cutoffbound)) );
170 assert( ! SCIPisInfinity(scip, REALABS(relaxval)) );
171 assert( SCIPisFeasGE(scip, cutoffbound, relaxval) );
173 *result = SCIP_DIDNOTFIND;
175 oldlb = SCIPvarGetLbLocal(var);
176 oldub = SCIPvarGetUbLocal(var);
177 assert( SCIPisLE(scip, oldlb, oldub) );
180 if ( SCIPisFeasEQ(scip, oldlb, oldub) )
185 if ( ! SCIPisInfinity(scip, oldub) && SCIPisFeasPositive(scip, primalubval) )
187 newlb = oldub - (cutoffbound - relaxval) / primalubval;
190 newlb = MAX(oldlb, newlb);
191 assert( ! SCIPisInfinity(scip, newlb) );
198 if ( ! SCIPisInfinity(scip, -oldlb) && SCIPisFeasPositive(scip, primallbval) )
200 newub = oldlb + (cutoffbound - relaxval) / primallbval;
203 newub = MIN(oldub, newub);
204 assert( ! SCIPisInfinity(scip, -newub) );
210 if ( SCIPisFeasGT(scip, newlb, newub) )
212 SCIPdebugMsg(scip,
"Node is infeasible. New bounds for variable <%s>: [%g, %g]!\n", SCIPvarGetName(var), newlb, newub);
213 *result = SCIP_CUTOFF;
218 if ( ! SCIPisInfinity(scip, -newlb) && SCIPisFeasGT(scip, newlb, oldlb) )
220 SCIPdebugMsg(scip,
"Changing lower bound of variable <%s> from %g to %g.\n", SCIPvarGetName(var), oldlb, newlb);
221 SCIP_CALL( SCIPchgVarLb(scip, var, newlb) );
222 *result = SCIP_REDUCEDDOM;
226 if ( ! SCIPisInfinity(scip, newub) && SCIPisFeasLT(scip, newub, oldub) )
228 SCIPdebugMsg(scip,
"Changing upper bound of variable <%s> from %g to %g.\n", SCIPvarGetName(var), oldub, newub);
229 SCIP_CALL( SCIPchgVarUb(scip, var, newub) );
230 *result = SCIP_REDUCEDDOM;
244 SCIP_RESULT varresult;
245 SCIP_Real cutoffbound;
248 SCIP_PROPDATA* propdata;
251 assert( scip != NULL );
252 assert( prop != NULL );
253 assert( result != NULL );
255 *result = SCIP_DIDNOTRUN;
258 if( ! SCIPallowWeakDualReds(scip) )
262 if ( SCIPgetStage(scip) == SCIP_STAGE_PRESOLVING )
265 cutoffbound = SCIPgetCutoffbound(scip);
266 if ( SCIPisInfinity(scip, cutoffbound) )
269 relax = SCIPfindRelax(scip,
"SDP");
270 assert( relax != NULL );
283 SCIPdebugMsg(scip,
"Do not run propagation because SDP-relaxation was not solved properly.\n");
288 if ( SCIPisInfinity(scip, REALABS(relaxval)) )
291 propdata = SCIPpropGetData(prop);
292 assert( propdata != NULL );
294 SCIPdebugMsg(scip,
"Running propExecSdpredcost ...\n");
295 *result = SCIP_DIDNOTFIND;
297 nvars = SCIPgetNVars(scip);
298 vars = SCIPgetVars(scip);
301 if ( nvars != propdata->nvars )
303 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &propdata->lbvarvals, propdata->nvars, nvars) );
304 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &propdata->ubvarvals, propdata->nvars, nvars) );
305 propdata->nvars = nvars;
311 for (v = 0; v < nvars; v++)
313 if ( SCIPvarIsBinary(vars[v]) && propdata->forbins )
315 SCIP_CALL(
sdpRedcostFixingBinary(scip, vars[v], propdata->lbvarvals[v], propdata->ubvarvals[v], cutoffbound, relaxval, &varresult) );
317 if ( varresult == SCIP_REDUCEDDOM )
318 *result = SCIP_REDUCEDDOM;
320 else if ( ! SCIPvarIsBinary(vars[v]) && propdata->forintconts )
322 SCIP_CALL(
sdpRedcostFixingIntCont(scip, vars[v], propdata->lbvarvals[v], propdata->ubvarvals[v], cutoffbound, relaxval, &varresult) );
324 if ( varresult == SCIP_REDUCEDDOM )
325 *result = SCIP_REDUCEDDOM;
336 SCIP_PROPDATA* propdata;
338 propdata = SCIPpropGetData(prop);
339 assert( propdata != NULL );
340 SCIPfreeBlockMemory(scip, &propdata);
342 SCIPpropSetData(prop, NULL);
351 SCIP_PROPDATA* propdata;
353 propdata = SCIPpropGetData(prop);
354 assert(propdata != NULL);
356 propdata->nvars = SCIPgetNVars(scip);
357 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(propdata->lbvarvals), propdata->nvars) );
358 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(propdata->ubvarvals), propdata->nvars) );
367 SCIP_PROPDATA* propdata;
369 propdata = SCIPpropGetData(prop);
370 assert( propdata != NULL );
372 SCIPfreeBlockMemoryArrayNull(scip, &(propdata->lbvarvals), propdata->nvars);
373 SCIPfreeBlockMemoryArrayNull(scip, &(propdata->ubvarvals), propdata->nvars);
382 assert( scip != NULL );
383 assert( prop != NULL );
384 assert( strcmp(SCIPpropGetName(prop),
PROP_NAME) == 0 );
397 SCIP_PROPDATA* propdata = NULL;
401 SCIP_CALL( SCIPallocBlockMemory(scip, &propdata) );
403 propdata->lbvarvals = NULL;
404 propdata->ubvarvals = NULL;
408 propExecSdpredcost, propdata) );
409 assert( prop != NULL );
412 SCIP_CALL( SCIPsetPropCopy(scip, prop, propCopySdpredcost) );
413 SCIP_CALL( SCIPsetPropInitsol(scip, prop, propInitsolSdpredcost) );
414 SCIP_CALL( SCIPsetPropExitsol(scip, prop, propExitsolSdpredcost) );
415 SCIP_CALL( SCIPsetPropFree(scip, prop, propFreeSdpredcost) );
418 SCIP_CALL( SCIPaddBoolParam(scip,
"propagating/" PROP_NAME "/forbins",
"Should SDP reduced cost fixing be executed for binary variables?",
421 SCIP_CALL( SCIPaddBoolParam(scip,
"propagating/" PROP_NAME "/forintconts",
"Should SDP reduced cost fixing be executed for integer and continuous variables?",
static SCIP_DECL_PROPFREE(propFreeSdpredcost)
static SCIP_DECL_PROPINITSOL(propInitsolSdpredcost)
SCIP_RETCODE SCIPrelaxSdpRelaxVal(SCIP_RELAX *relax, SCIP_Bool *success, SCIP_Real *objval)
General interface methods for SDP-preprocessing (mainly fixing variables and removing empty rows/cols...
static SCIP_DECL_PROPEXEC(propExecSdpredcost)
SCIP_RETCODE SCIPrelaxSdpGetPrimalBoundVars(SCIP *scip, SCIP_RELAX *relax, SCIP_VAR **vars, int nvars, SCIP_Real *lbvars, SCIP_Real *ubvars, SCIP_Bool *success)
static SCIP_DECL_PROPCOPY(propCopySdpredcost)
SCIP_Bool SCIPrelaxSdpSolvedOrig(SCIP_RELAX *relax)
reduced cost / dual fixing for SDPs
static SCIP_RETCODE sdpRedcostFixingIntCont(SCIP *scip, SCIP_VAR *var, SCIP_Real primallbval, SCIP_Real primalubval, SCIP_Real cutoffbound, SCIP_Real relaxval, SCIP_RESULT *result)
SCIP_Longint SCIPrelaxSdpGetSdpNode(SCIP_RELAX *relax)
static SCIP_DECL_PROPEXITSOL(propExitsolSdpredcost)
static SCIP_RETCODE sdpRedcostFixingBinary(SCIP *scip, SCIP_VAR *var, SCIP_Real primallbval, SCIP_Real primalubval, SCIP_Real cutoffbound, SCIP_Real relaxval, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludePropSdpredcost(SCIP *scip)
#define DEFAULT_SDPRCINTCONT