Loading...
Searching...
No Matches
pricestore_gcg.c
Go to the documentation of this file.
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
87 retcode = SCIPreallocBlockMemoryArray(pricestore->masterprob, &pricestore->cols[arrayindex], pricestore->colssize[arrayindex], newsize);
89 retcode = SCIPreallocBlockMemoryArray(pricestore->masterprob, &pricestore->objparallelisms[arrayindex], pricestore->colssize[arrayindex], newsize);
91 retcode = SCIPreallocBlockMemoryArray(pricestore->masterprob, &pricestore->orthogonalities[arrayindex], pricestore->colssize[arrayindex], newsize);
93 retcode = SCIPreallocBlockMemoryArray(pricestore->masterprob, &pricestore->scores[arrayindex], pricestore->colssize[arrayindex], newsize);
148 (*pricestore)->objparalfac = objparalfac; /* factor of objective parallelism in score function */
161 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->cols, (*pricestore)->narrays) );
162 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->objparallelisms, (*pricestore)->narrays) );
163 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->orthogonalities, (*pricestore)->narrays) );
164 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->scores, (*pricestore)->narrays) );
165 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->colssize, (*pricestore)->narrays) );
166 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->ncols, (*pricestore)->narrays) );
167 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(*pricestore)->nforcedcols, (*pricestore)->narrays) );
201 SCIPfreeBlockMemoryArrayNull(scip, &(*pricestore)->objparallelisms[i], (*pricestore)->colssize[i]);
202 SCIPfreeBlockMemoryArrayNull(scip, &(*pricestore)->orthogonalities[i], (*pricestore)->colssize[i]);
285 pricestore->cols[arrayindex][pos] = pricestore->cols[arrayindex][pricestore->ncols[arrayindex]];
286 pricestore->objparallelisms[arrayindex][pos] = pricestore->objparallelisms[arrayindex][pricestore->ncols[arrayindex]];
287 pricestore->orthogonalities[arrayindex][pos] = pricestore->orthogonalities[arrayindex][pricestore->ncols[arrayindex]];
377 if( SCIPgetStage(col->pricingprob) < SCIP_STAGE_PRESOLVING && GCGgetNActiveMastersepacuts(pricestore->gcg) == 0 )
398 assert(SCIPisFeasGE(col->pricingprob, val, SCIPvarGetLbGlobal(GCGpricingVarGetOrigvars(var)[0])) &&
410 pricestore->cols[arrayindex][pricestore->ncols[arrayindex]] = pricestore->cols[arrayindex][pos];
411 pricestore->objparallelisms[arrayindex][pricestore->ncols[arrayindex]] = pricestore->objparallelisms[arrayindex][pos];
412 pricestore->orthogonalities[arrayindex][pricestore->ncols[arrayindex]] = pricestore->orthogonalities[arrayindex][pos];
413 pricestore->scores[arrayindex][pricestore->ncols[arrayindex]] = pricestore->scores[arrayindex][pos];
414 pricestore->cols[arrayindex][pricestore->ncols[arrayindex]]->pos = pricestore->ncols[arrayindex];
437 pricestore->cols[arrayindex][oldpos] = pricestore->cols[arrayindex][pricestore->nforcedcols[arrayindex]];
438 pricestore->objparallelisms[arrayindex][oldpos] = pricestore->objparallelisms[arrayindex][pricestore->nforcedcols[arrayindex]];
439 pricestore->orthogonalities[arrayindex][oldpos] = pricestore->orthogonalities[arrayindex][pricestore->nforcedcols[arrayindex]];
440 pricestore->scores[arrayindex][oldpos] = pricestore->scores[arrayindex][pricestore->nforcedcols[arrayindex]];
483/** updates the orthogonalities and scores of the non-forced cols after the given col was added to the LP */
511 SCIPdebugMessage(" -> deleting parallel col %p after adding %p (pos=%d, orthogonality=%g, score=%g)\n",
554/** adds the given col to priced vars, updates the orthogonalities and scores of remaining cols, and frees non-forced cols */
571 SCIP_CALL( GCGcreateNewMasterVarFromGcgCol(pricestore->gcg, pricestore->infarkas, col, force, added, NULL, score) );
581 if( SCIPisGT(pricestore->masterprob, mincolorthogonality, SCIPepsilon(pricestore->masterprob)) || SCIPisPositive(pricestore->masterprob, pricestore->orthofac))
703 SCIP_CALL( SCIPallocClearBufferArray(masterprob, &ncolsappliedprob, GCGgetNPricingprobs(pricestore->gcg)) );
709 /* Compute scores for all non-forced cols and initialize orthogonalities - make sure all cols are initialized again for the current dual solution */
734 SCIP_CALL( pricestoreApplyCol(pricestore, col, TRUE, mincolorthogonality, pricestore->scores[i][pos], &added) );
780 * Note: do not take SCIPsetIsEfficacious(), because constraint handlers often add cols w.r.t. SCIPsetIsFeasPositive().
781 * Note2: if pricerating/feastolfac != -1, constraint handlers may even add cols w.r.t. SCIPsetIsPositive(); those are currently rejected here
790 SCIPdebugMessage(" -> applied col %p (pos=%d/%d, probnr=%d, efficacy=%g, objparallelism=%g, orthogonality=%g, score=%g)\n",
791 (void*) col, bestpos+1, pricestore->ncols[i], probnr, GCGcolGetRedcost(col), pricestore->objparallelisms[i][bestpos],
849 /* if we have just finished the initial LP construction, free the (potentially large) cols array */
854 SCIPfreeBlockMemoryArrayNull(pricestore->masterprob, &pricestore->cols[i], pricestore->colssize[i]);
855 SCIPfreeBlockMemoryArrayNull(pricestore->masterprob, &pricestore->objparallelisms[i], pricestore->colssize[i]);
856 SCIPfreeBlockMemoryArrayNull(pricestore->masterprob, &pricestore->orthogonalities[i], pricestore->colssize[i]);
857 SCIPfreeBlockMemoryArrayNull(pricestore->masterprob, &pricestore->scores[i], pricestore->colssize[i]);
#define SCIP_INVALID
#define SCIP_Bool
#define SCIP_Real
#define MAX(x, y)
#define SCIP_REAL_MIN
#define TRUE
#define FALSE
int GCGgetNActiveMastersepacuts(GCG *gcg)
Definition event_mastersepacut.c:741
GCG interface methods.
GCG_EXPORT SCIP_Bool GCGvarIsInferredPricing(SCIP_VAR *var)
Definition gcgvar.c:195
SCIP_RETCODE GCGcreateNewMasterVarFromGcgCol(GCG *gcg, SCIP_Bool infarkas, GCG_COL *gcgcol, SCIP_Bool force, SCIP_Bool *added, SCIP_VAR **addedvar, SCIP_Real score)
Definition pricer_gcg.cpp:4404
SCIP_RETCODE GCGcolpoolAddCol(GCG_COLPOOL *colpool, GCG_COL *col, SCIP_Bool freeduplicate)
Definition colpool.c:215
SCIP_RETCODE GCGcolComputeDualObjPara(GCG *gcg, GCG_COL *gcgcol, SCIP_Real *para)
Definition gcgcol.c:825
SCIP_RETCODE GCGcolComputeOrth(GCG *gcg, GCG_COL *gcgcol1, GCG_COL *gcgcol2, SCIP_Real *orth)
Definition gcgcol.c:984
SCIP_STAGE SCIPgetStage(SCIP *scip)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocClearBufferArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisDualfeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
SCIPfreeBufferArray(scip, &cycles)
#define NULL
Definition class_conspartition.cpp:44
GCG variable pricer.
void GCGpricestoreEndFarkas(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:229
static GCG_COL * pricestoreGetBestCol(GCG_PRICESTORE *pricestore, int *ncolsapplied, int maxpricecolsprob)
Definition pricestore_gcg.c:594
SCIP_RETCODE GCGpricestoreApplyCols(GCG_PRICESTORE *pricestore, GCG_COLPOOL *colpool, SCIP_Bool usecolpool, int *nfoundvars)
Definition pricestore_gcg.c:675
static SCIP_RETCODE pricestoreUpdateOrthogonalities(GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Real mincolorthogonality)
Definition pricestore_gcg.c:485
static SCIP_RETCODE pricestoreEnsureColsMem(GCG_PRICESTORE *pricestore, int arrayindex, int num)
Definition pricestore_gcg.c:70
SCIP_RETCODE GCGpricestoreFree(GCG_PRICESTORE **pricestore)
Definition pricestore_gcg.c:184
int GCGpricestoreGetNColsApplied(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:918
static SCIP_RETCODE computeScore(GCG_PRICESTORE *pricestore, int arrayindex, int pos)
Definition pricestore_gcg.c:631
int GCGpricestoreGetNColsTotal(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:888
int GCGpricestoreGetNCols(GCG_PRICESTORE *pricestore, int arrayindex)
Definition pricestore_gcg.c:877
void GCGpricestoreEndForceCols(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:251
int GCGpricestoreGetNColsFound(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:898
void GCGpricestoreStartFarkas(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:218
int GCGpricestoreGetNColsFoundRound(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:908
SCIP_RETCODE GCGpricestoreAddCol(GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Bool forcecol, SCIP_Bool fromcolpool, SCIP_Bool *added)
Definition pricestore_gcg.c:314
GCG_COL ** GCGpricestoreGetCols(GCG_PRICESTORE *pricestore, int arrayindex)
Definition pricestore_gcg.c:866
static SCIP_RETCODE pricestoreDelCol(GCG_PRICESTORE *pricestore, int arrayindex, int pos, SCIP_Bool freecol)
Definition pricestore_gcg.c:263
static int pricestoreFindEqualCol(GCG_PRICESTORE *pricestore, GCG_COL *col)
Definition pricestore_gcg.c:298
static SCIP_RETCODE pricestoreApplyCol(GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Bool force, SCIP_Real mincolorthogonality, SCIP_Real score, SCIP_Bool *added)
Definition pricestore_gcg.c:556
void GCGpricestoreStartForceCols(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:240
static int pricestoreGetArrayIndex(GCG_PRICESTORE *pricestore, GCG_COL *col)
Definition pricestore_gcg.c:106
SCIP_RETCODE GCGpricestoreClearCols(GCG_PRICESTORE *pricestore)
Definition pricestore_gcg.c:820
SCIP_RETCODE GCGpricestoreCreate(GCG *gcg, GCG_PRICESTORE **pricestore, SCIP_Real efficiacyfac, SCIP_Real objparalfac, SCIP_Real orthofac, SCIP_Real mincolorth, GCG_EFFICIACYCHOICE efficiacychoice, int hashtablesize)
Definition pricestore_gcg.c:117
methods for storing priced cols (based on SCIP's separation storage)
public methods for working with gcg columns
public methods for GCG variables
#define SCIPerrorMessage
GCG_EFFICIACYCHOICE efficiacychoice
Definition struct_pricestore_gcg.h:78
data structure to store columns (solutions from a pricing problem)
data structures for storing OpenMP locks
datastructures for storing priced cols
data structures for separators for master
@ GCG_EFFICIACYCHOICE_STEEPESTEDGE
Definition type_pricestore_gcg.h:48
SCIP_INVALIDCALL
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_PRESOLVING
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR