94 #define EVENTHDLR_NAME "addedvar" 95 #define EVENTHDLR_DESC "event handler for catching added variables" 108 assert(eventhdlr !=
NULL);
110 assert(event !=
NULL);
113 SCIPdebugMsg(
scip,
"exec method of event handler for added variable to probdata\n");
143 assert(scip !=
NULL);
144 assert(probdata !=
NULL);
155 (*probdata)->vars =
NULL;
162 (*probdata)->nvars = nvars;
163 (*probdata)->varssize = nvars;
164 (*probdata)->nitems = nitems;
165 (*probdata)->capacity = capacity;
179 assert(scip !=
NULL);
180 assert(probdata !=
NULL);
183 for( i = 0; i < (*probdata)->nvars; ++i )
189 for( i = 0; i < (*probdata)->nitems; ++i )
224 conss = probdata->conss;
226 weights = probdata->weights;
227 nitems = probdata->nitems;
230 for( i = 0; i < nitems; ++i )
236 SCIPdebugMsg(scip,
"create variable for item %d with weight = %"SCIP_LONGINT_FORMAT
"\n", ids[i], weights[i]);
297 sourcedata->nvars, sourcedata->nitems, sourcedata->capacity) );
325 assert(probdata !=
NULL);
329 assert(eventhdlr !=
NULL);
342 assert(probdata !=
NULL);
346 assert(eventhdlr !=
NULL);
365 const char* probname,
377 assert(scip !=
NULL);
403 for( i = 0; i < nitems; ++i )
435 return probdata->ids;
443 return probdata->weights;
451 return probdata->nitems;
459 return probdata->capacity;
467 return probdata->vars;
475 return probdata->nvars;
483 return probdata->conss;
494 if( probdata->varssize == probdata->nvars )
497 newsize =
MAX(100, probdata->varssize * 2);
499 probdata->varssize = newsize;
505 probdata->vars[probdata->nvars] = var;
508 SCIPdebugMsg(scip,
"added variable to probdata; nvars = %d\n", probdata->nvars);
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPpricerBinpackingActivate(SCIP *scip, SCIP_CONS **conss, SCIP_Longint *weights, int *ids, int nitems, SCIP_Longint capacity)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
static SCIP_DECL_PROBDELTRANS(probdeltransBinpacking)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
SCIP_RETCODE SCIPtransformConss(SCIP *scip, int nconss, SCIP_CONS **conss, SCIP_CONS **transconss)
SCIP_RETCODE SCIPsetProbExitsol(SCIP *scip, SCIP_DECL_PROBEXITSOL((*probexitsol)))
Binpacking variable pricer.
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
struct SCIP_VarData SCIP_VARDATA
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, int *ids, SCIP_Longint *weights, int nitems, SCIP_Longint capacity)
SCIP_RETCODE SCIPsetProbData(SCIP *scip, SCIP_PROBDATA *probdata)
static SCIP_DECL_PROBEXITSOL(probexitsolBinpacking)
Variable data containing the ids of constraints in which the variable appears.
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
#define SCIPfreeBufferArray(scip, ptr)
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPallocBlockMemory(scip, ptr)
SCIP_VAR ** SCIPprobdataGetVars(SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
SCIP_RETCODE SCIPtransformVars(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **transvars)
static SCIP_RETCODE probdataCreate(SCIP *scip, SCIP_PROBDATA **probdata, SCIP_VAR **vars, SCIP_CONS **conss, SCIP_Longint *weights, int *ids, int nvars, int nitems, SCIP_Longint capacity)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
static SCIP_DECL_PROBTRANS(probtransBinpacking)
SCIP_RETCODE SCIPsetObjIntegral(SCIP *scip)
SCIP_RETCODE SCIPcreateVarBinpacking(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real obj, SCIP_Bool initial, SCIP_Bool removable, SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint * SCIPprobdataGetWeights(SCIP_PROBDATA *probdata)
static SCIP_DECL_EVENTEXEC(eventExecAddedVar)
SCIP_Longint SCIPprobdataGetCapacity(SCIP_PROBDATA *probdata)
static SCIP_DECL_PROBINITSOL(probinitsolBinpacking)
SCIP_RETCODE SCIPcreateConsBasicSetcover(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
SCIP_RETCODE SCIPvardataCreateBinpacking(SCIP *scip, SCIP_VARDATA **vardata, int *consids, int nconsids)
int * SCIPprobdataGetIds(SCIP_PROBDATA *probdata)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
SCIP_RETCODE SCIPsetProbTrans(SCIP *scip, SCIP_DECL_PROBTRANS((*probtrans)))
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Problem data for binpacking problem.
int SCIPprobdataGetNItems(SCIP_PROBDATA *probdata)
SCIP_CONS ** SCIPprobdataGetConss(SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPprobdataAddVar(SCIP *scip, SCIP_PROBDATA *probdata, SCIP_VAR *var)
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
int SCIPprobdataGetNVars(SCIP_PROBDATA *probdata)
static SCIP_RETCODE probdataFree(SCIP *scip, SCIP_PROBDATA **probdata)
SCIP_RETCODE SCIPsetProbInitsol(SCIP *scip, SCIP_DECL_PROBINITSOL((*probinitsol)))
static SCIP_DECL_PROBDELORIG(probdelorigBinpacking)
struct SCIP_ProbData SCIP_PROBDATA
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_PROBDATA * SCIPgetProbData(SCIP *scip)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
static SCIP_RETCODE createInitialColumns(SCIP *scip, SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPsetConsModifiable(SCIP *scip, SCIP_CONS *cons, SCIP_Bool modifiable)
SCIP_RETCODE SCIPsetProbDeltrans(SCIP *scip, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
SCIP_RETCODE SCIPsetProbDelorig(SCIP *scip, SCIP_DECL_PROBDELORIG((*probdelorig)))
#define SCIP_EVENTTYPE_VARADDED
void SCIPvarSetData(SCIP_VAR *var, SCIP_VARDATA *vardata)