33#ifndef __SCIP_PARA_OBJPROP_H__
34#define __SCIP_PARA_OBJPROP_H__
40#include "objscip/objprop.h"
42#ifdef UG_DEBUG_SOLUTION
43#ifndef WITH_DEBUG_SOLUTION
44#define WITH_DEBUG_SOLUTION
46#include "scip/debug.h"
70 ) : scip::ObjProp::ObjProp(
73 "Propagator for updating variable bounds",
77 SCIP_PROPTIMING_ALWAYS,
80 SCIP_PRESOLTIMING_FAST
89 std::list<BoundChange *>::iterator it =
boundChanges.begin();
100 SCIP_RETCODE
applyBoundChanges(SCIP *scip,
int& ntightened,
int& ntightenedint, SCIP_RESULT *result )
106 *result = SCIP_DIDNOTFIND;
108 std::list<BoundChange *>::iterator it =
boundChanges.begin();
112 SCIP_Var **orgVars = SCIPgetOrigVars(scip);
113 SCIP_Var *var = SCIPvarGetTransVar(orgVars[bc->
index]);
114 if ( *result != SCIP_CUTOFF && var && SCIPvarGetStatus(var) != SCIP_VARSTATUS_FIXED && SCIPvarGetStatus(var) != SCIP_VARSTATUS_MULTAGGR && SCIPvarGetStatus(var) != SCIP_VARSTATUS_AGGREGATED )
116 if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_NEGATED )
118 SCIP_Var *varNeg = 0;
119 SCIP_CALL_ABORT ( SCIPgetNegatedVar(scip, var, &varNeg) );
120 if( SCIPvarIsActive(varNeg) )
122#ifdef UG_DEBUG_SOLUTION
123 SCIP_Real solvalue = 0.0;
124 SCIP_CALL(SCIPdebugGetSolVal(scip,orgVars[bc->
index], &solvalue));
125 std::cout <<
"Receiver side SolValue: " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << solvalue << std::endl;
126 if( bc->
boundType == SCIP_BOUNDTYPE_LOWER )
128 std::cout <<
"Receiver side (SCIP_BOUNDTYPE_LOWER): " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << bc->
bound << std::endl;
129 SCIP_CALL_ABORT( SCIPdebugCheckLbGlobal(scip,orgVars[bc->
index],bc->
bound) );
133 std::cout <<
"Receiver side (SCIP_BOUNDTYPE_UPPER): " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << bc->
bound << std::endl;
134 SCIP_CALL_ABORT( SCIPdebugCheckUbGlobal(scip,orgVars[bc->
index],bc->
bound) );
142#ifdef UG_DEBUG_SOLUTION
143 SCIP_Real solvalue = 0.0;
144 SCIP_CALL(SCIPdebugGetSolVal(scip,orgVars[bc->
index], &solvalue));
145 std::cout <<
"Receiver side SolValue: " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << solvalue << std::endl;
146 if( bc->
boundType == SCIP_BOUNDTYPE_LOWER )
148 std::cout <<
"Receiver side (SCIP_BOUNDTYPE_LOWER): " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << bc->
bound << std::endl;
149 SCIP_CALL_ABORT( SCIPdebugCheckLbGlobal(scip,orgVars[bc->
index],bc->
bound) );
153 std::cout <<
"Receiver side (SCIP_BOUNDTYPE_UPPER): " << SCIPvarGetName(orgVars[bc->
index]) <<
" = " << bc->
bound << std::endl;
154 SCIP_CALL_ABORT( SCIPdebugCheckUbGlobal(scip,orgVars[bc->
index],bc->
bound) );
173 *result = SCIP_DIDNOTRUN;
188 *nchgbds += ntightened;
191 if( *result != SCIP_CUTOFF )
192 *result = SCIP_SUCCESS;
195 SCIPpropSetFreq(prop, -1);
206 *result = SCIP_DIDNOTRUN;
208 if( SCIPinProbing(scip) || SCIPinRepropagation(scip) )
223 if( *result != SCIP_CUTOFF )
224 *result = SCIP_REDUCEDDOM;
227 SCIPpropSetFreq(prop, -1);
231 SCIP_RETCODE
tryToTightenBound(SCIP *scip, SCIP_BOUNDTYPE boundType, SCIP_VAR *var, SCIP_Real bound, SCIP_Result *result,
int& ntightened,
int& ntightenedint )
233 SCIP_Bool infeas, tightened;
234 if( boundType == SCIP_BOUNDTYPE_LOWER )
237 SCIP_CALL( SCIPtightenVarLbGlobal(scip, var, bound, FALSE, &infeas, &tightened) );
241 assert(boundType == SCIP_BOUNDTYPE_UPPER);
243 SCIP_CALL( SCIPtightenVarUbGlobal(scip, var, bound, FALSE, &infeas, &tightened) );
251 *result = SCIP_CUTOFF;
257 if( SCIPvarGetType(var) == SCIP_VARTYPE_BINARY
258 || SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER )
264 void addBoundChange(SCIP *scip, SCIP_BOUNDTYPE boundType,
int index, SCIP_Real bound)
271 SCIPsetIntParam(scip,
"propagating/ScipParaObjProp/freq", 1);
virtual ~ScipParaObjProp()
virtual SCIP_DECL_PROPPRESOL(scip_presol)
virtual SCIP_DECL_PROPEXEC(scip_exec)
SCIP_RETCODE tryToTightenBound(SCIP *scip, SCIP_BOUNDTYPE boundType, SCIP_VAR *var, SCIP_Real bound, SCIP_Result *result, int &ntightened, int &ntightenedint)
std::list< BoundChange * > boundChanges
SCIP_RETCODE applyBoundChanges(SCIP *scip, int &ntightened, int &ntightenedint, SCIP_RESULT *result)
void addBoundChange(SCIP *scip, SCIP_BOUNDTYPE boundType, int index, SCIP_Real bound)
ScipParaObjProp(UG::ParaComm *comm, ScipParaSolver *inSolver)
double getPendingIncumbentValue()
get pending incumbent value
Base class of communicator object.
static ScipParaCommTh * comm
Base class of communicator for UG Framework.
ParaSolver extension for SCIP: Parallelized solver implementation for SCIP.