89 #define PRICER_NAME "binpacking" 90 #define PRICER_DESC "pricer for binpacking tours" 91 #define PRICER_PRIORITY 0 92 #define PRICER_DELAY TRUE 102 struct SCIP_PricerData
141 assert( scip !=
NULL );
142 assert( subscip !=
NULL );
143 assert( conshdlr !=
NULL );
152 for( c = 0; c < nconss; ++c )
167 SCIPdebugMsg(scip,
"create varbound for %s(%d,%d)\n", type ==
SAME ?
"same" :
"diff",
200 vars[id1], vars[id2], vbdcoef, lhs, rhs) );
249 for( v = 0; v < norigvars; ++v )
256 SCIPdebugMsg(scip,
"variable <%s> glb=[%.15g,%.15g] loc=[%.15g,%.15g] is fixed to zero\n",
274 for( c = 0, o = 0; o < nitems && needed; ++o )
292 logicorvars[nlogicorvars] = var;
295 else if( o == consid )
302 consid = nitems + 100;
305 assert(consid < consids[c]);
349 assert(pricerdata !=
NULL);
351 nitems = pricerdata->nitems;
352 conss = pricerdata->conss;
353 weights = pricerdata->weights;
354 capacity = pricerdata->capacity;
360 for( c = 0; c < nitems; ++c )
386 vals[nvars] = weights[c];
425 assert(pricer !=
NULL);
429 if( pricerdata !=
NULL)
452 assert(pricer !=
NULL);
455 assert(pricerdata !=
NULL);
458 for( c = 0; c < pricerdata->nitems; ++c )
460 cons = pricerdata->conss[c];
484 assert(pricer !=
NULL);
487 assert(pricerdata !=
NULL);
490 for( c = 0; c < pricerdata->nitems; ++c )
522 assert(pricer !=
NULL);
528 assert(pricerdata !=
NULL);
530 capacity = pricerdata->capacity;
531 conss = pricerdata->conss;
532 ids = pricerdata->ids;
533 nitems = pricerdata->nitems;
579 for( s = 0; s < nsols; ++s )
619 for( o = 0, v = 0; o < nitems; ++o )
629 strcat(name, strtmp);
657 for( v = 0; v < nconss; ++v )
728 assert(pricerdata->conshdlr !=
NULL);
730 pricerdata->conss =
NULL;
731 pricerdata->weights =
NULL;
732 pricerdata->ids =
NULL;
733 pricerdata->nitems = 0;
734 pricerdata->capacity = 0;
738 pricerRedcostBinpacking, pricerFarkasBinpacking, pricerdata) );
765 assert(scip !=
NULL);
766 assert(conss !=
NULL);
767 assert(weights !=
NULL);
771 assert(pricer !=
NULL);
774 assert(pricerdata !=
NULL);
781 pricerdata->nitems = nitems;
782 pricerdata->capacity = capacity;
784 SCIPdebugMsg(scip,
" nitems: %d capacity: %"SCIP_LONGINT_FORMAT
" \n", nitems, capacity);
788 for( c = 0; c < nitems; ++c )
SCIP_RETCODE SCIPpricerBinpackingActivate(SCIP *scip, SCIP_CONS **conss, SCIP_Longint *weights, int *ids, int nitems, SCIP_Longint capacity)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
static SCIP_RETCODE addFixedVarsConss(SCIP *scip, SCIP *subscip, SCIP_VAR **vars, SCIP_CONS **conss, int nitems)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
static SCIP_DECL_PRICEREXITSOL(pricerExitsolBinpacking)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_STAGE SCIPgetStage(SCIP *scip)
Constraint handler for variable bound constraints .
int SCIPgetNFixedonesSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPincludePricerBinpacking(SCIP *scip)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
Constraint handler stores the local branching decision data.
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Binpacking variable pricer.
SCIP_SOL ** SCIPgetSols(SCIP *scip)
struct SCIP_VarData SCIP_VARDATA
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_PRICER * SCIPfindPricer(SCIP *scip, const char *name)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
SCIP_PRICERDATA * SCIPpricerGetData(SCIP_PRICER *pricer)
Variable data containing the ids of constraints in which the variable appears.
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_RETCODE SCIPsetPricerExitsol(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICEREXITSOL((*pricerexitsol)))
#define SCIPfreeBufferArray(scip, ptr)
SCIP_RETCODE SCIPcreate(SCIP **scip)
Constraint handler for the set partitioning / packing / covering constraints .
int * SCIPvardataGetConsids(SCIP_VARDATA *vardata)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPdebugMsgPrint
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
static SCIP_DECL_PRICERINIT(pricerInitBinpacking)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Constraint handler for knapsack constraints of the form , x binary and .
SCIP_RETCODE SCIPsolve(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)
static SCIP_DECL_PRICERFARKAS(pricerFarkasBinpacking)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludePricerBasic(SCIP *scip, SCIP_PRICER **pricerptr, const char *name, const char *desc, int priority, SCIP_Bool delay, SCIP_DECL_PRICERREDCOST((*pricerredcost)), SCIP_DECL_PRICERFARKAS((*pricerfarkas)), SCIP_PRICERDATA *pricerdata)
SCIP_Real SCIPgetDualsolSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
int SCIPgetItemid2Samediff(SCIP *scip, SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
const char * SCIPvarGetName(SCIP_VAR *var)
static SCIP_DECL_PRICERFREE(pricerFreeBinpacking)
SCIP_RETCODE SCIPcreateConsBasicLogicor(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetPricerInit(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERINIT((*pricerinit)))
SCIP_RETCODE SCIPgetTransformedCons(SCIP *scip, SCIP_CONS *cons, SCIP_CONS **transcons)
SCIP_RETCODE SCIPcreateConsBasicKnapsack(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Longint *weights, SCIP_Longint capacity)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPvardataCreateBinpacking(SCIP *scip, SCIP_VARDATA **vardata, int *consids, int nconsids)
int * SCIPprobdataGetIds(SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPactivatePricer(SCIP *scip, SCIP_PRICER *pricer)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
Problem data for binpacking problem.
CONSTYPE SCIPgetTypeSamediff(SCIP *scip, SCIP_CONS *cons)
SCIP_VARDATA * SCIPvarGetData(SCIP_VAR *var)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPsetPricerFree(SCIP *scip, SCIP_PRICER *pricer, SCIP_DECL_PRICERFREE((*pricerfree)))
int SCIPgetNSols(SCIP *scip)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPcreateConsBasicVarbound(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *var, SCIP_VAR *vbdvar, SCIP_Real vbdcoef, SCIP_Real lhs, SCIP_Real rhs)
int SCIPgetItemid1Samediff(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPaddPricedVar(SCIP *scip, SCIP_VAR *var, SCIP_Real score)
static SCIP_RETCODE addBranchingDecisionConss(SCIP *scip, SCIP *subscip, SCIP_VAR **vars, SCIP_CONSHDLR *conshdlr)
SCIP_Longint SCIPgetMemUsed(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_PROBDATA * SCIPgetProbData(SCIP *scip)
static SCIP_DECL_PRICERREDCOST(pricerRedcostBinpacking)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
int SCIPvardataGetNConsids(SCIP_VARDATA *vardata)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
struct SCIP_PricerData SCIP_PRICERDATA
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
static SCIP_RETCODE initPricing(SCIP *scip, SCIP_PRICERDATA *pricerdata, SCIP *subscip, SCIP_VAR **vars)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPprintVar(SCIP *scip, SCIP_VAR *var, FILE *file)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_RETCODE SCIPsetConsInitial(SCIP *scip, SCIP_CONS *cons, SCIP_Bool initial)
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)