Loading...
Searching...
No Matches
decomp.c
Go to the documentation of this file.
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
393 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingvars, SCIPcalcMemGrowSize(scip, linkingvarsize));
413/** for a given constraint, check which of its variables were previously determined to be copied directly to the master,
450 if( (int) (size_t) SCIPhashmapGetImage(decomp->vartoblock, probvar) == decomp->nblocks+1 ) /*lint !e507 */
457 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decomp->subscipvars[block], oldsize, newsize) ) /*lint !e866 */;
535 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "ncalls of createdecompfrompartialdec: %d \n", ncalls);
570 SCIPfreeBlockMemoryArrayNull(scip, &(decomp->subscipvars[i]), SCIPcalcMemGrowSize(scip, decomp->nsubscipvars[i])); /*lint !e866*/
582 SCIPfreeBlockMemoryArrayNull(scip, &decomp->subscipconss[i], SCIPcalcMemGrowSize(scip, decomp->nsubscipconss[i])); /*lint !e866*/
610 SCIPfreeBlockMemoryArrayNull(scip, &decomp->stairlinkingvars[i], SCIPcalcMemGrowSize(scip, decomp->nstairlinkingvars[i])); /*lint !e866*/
631 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingvars, SCIPcalcMemGrowSize(scip, decomp->nlinkingvars));
634 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingconss, SCIPcalcMemGrowSize(scip, decomp->nlinkingconss));
637 SCIPfreeBlockMemoryArrayNull(scip, &decomp->detectorchain, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
638 SCIPfreeBlockMemoryArrayNull(scip, &decomp->detectorclocktimes, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
639 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarstoborder, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
640 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconsstoborder, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
641 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarstoblock, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
642 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconsstoblock, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
643 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarsfromopen, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
644 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconssfromopen, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
645 SCIPfreeBlockMemoryArrayNull(scip, &decomp->nnewblocks, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
653 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "ncalls of createdecompfrompartialdec: %d \n", ncalls);
896 SCIPerrorMessage("Block %d is empty and thus invalid. Each block needs at least one constraint.\n", b);
978 SCIPerrorMessage("Number of linking constraints and linking constraint array are inconsistent.\n");
1047 SCIPerrorMessage("Number of linking variables and linking variable array are inconsistent.\n");
1088/** returns the number of linking variables that are purely master ("static") variables of the given decomposition */
1128 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &decomp->stairlinkingvars, decomp->nblocks) ); /* this is more efficient */
1129 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &decomp->nstairlinkingvars, decomp->nblocks) ); /* this is more efficient */
1144 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(decomp->stairlinkingvars[b]), size) ); /*lint !e866 */
1145 BMScopyMemoryArray(decomp->stairlinkingvars[b], stairlinkingvars[b], nstairlinkingvars[b]); /*lint !e866 */
1343 SCIP_CALL_QUIET( fillOutConsFromConstoblock(gcg, decomp, constoblock, nblocks, conss, nconss, &haslinking) );
1351 SCIP_CALL( fillOutVarsFromVartoblock(gcg, decomp, vartoblock, nblocks, vars, nvars, &haslinking) );
1472/** completely fills out decomposition structure from only the constraint partition in the following manner:
1473 * given constraint block/border assignment (by constoblock), one gets the following assignment of probvars:
1475 * (i) constoblock(i) iff constoblock(i1) == constoblock(i2) for all i1,i2 in C(j) with constoblock(i1) != nblocks+1 && constoblock(i2) != nblocks+1
1476 * (ii) nblocks+2 ["linking var"] iff exists i1,i2 with constoblock(i1) != constoblock(i2) && constoblock(i1) != nblocks+1 && constoblock(i2) != nblocks+1
1482 SCIP_HASHMAP* constoblock, /**< constraint to block hashmap, start with 1 for first block and nblocks+1 for linking constraints */
1542 SCIPdebugMessage("cons <%s> (%d vars) is in block %d.\n", SCIPconsGetName(conss[i]), ncurvars, consblock);
1563 SCIPdebugMessage(" var <%s> not been handled before, adding to block %d\n", SCIPvarGetName(probvar), consblock);
1570 SCIPdebugMessage(" var <%s> has been handled before, adding to linking (%d != %d)\n", SCIPvarGetName(probvar), consblock, varblock);
1577 SCIPdebugMessage(" var <%s> is handled and in same block as cons (%d == %d).\n", SCIPvarGetName(probvar), consblock, varblock);
1584 /* Handle variables that do not appear in any pricing problem, those will be copied directly to the master */
1594 retcode = GCGfilloutDecompFromHashmaps(gcg, decomp, vartoblock, constoblock, nblocks, staircase && haslinking);
1733 const char* detectorchainstring /**< string for the detector information working on that decomposition */
1738 SCIP_CALL (SCIPduplicateBlockMemoryArray(scip, &(decomp->detectorchainstring), detectorchainstring, SCIP_MAXSTRLEN ) );
1753/** sets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1778/** gets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1787/** sets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1815/** gets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1823/** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1827 SCIP_Real* pctVarsToBlock /**< percentage of variables assigned to some block in the detector chain */
1849/** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1857/** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1861 SCIP_Real* pctConssToBlock /**< percentage of constraints assigned to some block in the detector chain */
1884/** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1894/** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1898 SCIP_Real* pctVarsFromOpen /**< percentage of open variables assigned to some block in the detector chain */
1923/** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1931/** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1935 SCIP_Real* pctConssFromOpen /**< percentage of open variables assigned to some block in the detector chain */
1960/** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain)
1969/** sets the number of new blocks of the corresponding detectors (of the detector chain) on this decomposition */
1996/** gets the number of new blocks corresponding detectors (of the detector chain) on this decomposition */
2031 (void*) decomp->subscipconss[b][c], SCIPconsIsTransformed(decomp->subscipconss[b][c])?"t":"o" );
2042 SCIP_CALL( SCIPhashmapSetImage(newconstoblock, decomp->subscipconss[b][c], (void*) (size_t) (b+1)) );
2066 /* the probvar can also be fixed, in which case we do not need it in the block; furthermore, multiple variables
2067 * can resolve to the same active problem variable, so we check whether we already handled the variable
2075 (void*)decomp->subscipvars[b][idx], SCIPvarIsTransformed(decomp->subscipvars[b][idx])?"t":"o" );
2079 SCIP_CALL( SCIPhashmapSetImage(newvartoblock, decomp->subscipvars[b][idx], (void*) (size_t) (b+1)) );
2091 SCIPdebugMessage("m, %d: %s (%s)\n", c, SCIPconsGetName(decomp->linkingconss[c]), SCIPconsIsTransformed(decomp->linkingconss[c])?"t":"o" );
2100 SCIP_CALL( SCIPhashmapSetImage(newconstoblock, decomp->linkingconss[c],(void*) (size_t) (decomp->nblocks+1) ) );
2121 block = (int) (size_t) SCIPhashmapGetImage(decomp->vartoblock, decomp->linkingvars[v]); /*lint !e507*/
2129 SCIP_CALL( SCIPhashmapSetImage(newvartoblock, decomp->linkingvars[v], (void*) (size_t) (block) ) );
2146 * Remove all those constraints that were removed from the problem after the decomposition had been created
2204 * Adds all those constraints that were added to the problem after the decomposition had been created
2229 SCIPdebugMessage("add remaining: cons <%s> in block %d/%d\n", SCIPconsGetName(cons), block, GCGdecompGetNBlocks(decdecomp) );
2246 SCIPwarningMessage(scip, "Decomposition type changed to 'bordered' due to an added constraint.\n");
2250 SCIPwarningMessage(scip, "Decomposition type changed to 'arrowhead' due to an added constraint.\n");
2266 SCIP_CALL( SCIPhashmapInsert(decdecomp->constoblock, cons, (void*) (size_t) (GCGdecompGetNBlocks(decdecomp)+1)) );
2278 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decdecomp->subscipconss[block], oldsize, newsize) ); /*lint !e866*/
2308 SCIPdebugMessage("Problem is %stransformed\n", SCIPgetStage(scip) >= SCIP_STAGE_TRANSFORMED ? "": "not ");
2312 if( SCIPisEQ(scip, SCIPvarGetLbGlobal(SCIPgetVars(scip)[v]), SCIPvarGetUbGlobal(SCIPgetVars(scip)[v]) ) && SCIPisEQ(scip, SCIPvarGetUbGlobal(SCIPgetVars(scip)[v]), 0. ) )
2334 SCIPdebugMessage("Cons <%s> in block %d = %d\n", SCIPconsGetName(cons), b, ((int) (size_t) SCIPhashmapGetImage(GCGdecompGetConstoblock(decdecomp), cons)) -1); /*lint !e507*/
2338 assert(((int) (size_t) SCIPhashmapGetImage(GCGdecompGetConstoblock(decdecomp), cons)) - 1 == b); /*lint !e507*/
2350 if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_FIXED || SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var) )
2353 varblock = ((int) (size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decdecomp), var)) - 1; /*lint !e507*/
2364 assert((GCGdecompGetSubscipvars(decdecomp)[b] == NULL) == (GCGdecompGetNSubscipvars(decdecomp)[b] == 0));
2371 varblock = ((int) (size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decdecomp), var)) - 1; /*lint !e507*/
2383 varblock = (int) (size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decdecomp), GCGdecompGetLinkingvars(decdecomp)[v]); /*lint !e507*/
2384 assert( varblock == GCGdecompGetNBlocks(decdecomp) +1 || varblock == GCGdecompGetNBlocks(decdecomp)+2); /*lint !e507*/
2388 assert(((int) (size_t) SCIPhashmapGetImage(GCGdecompGetConstoblock(decdecomp), GCGdecompGetLinkingconss(decdecomp)[c])) -1 == GCGdecompGetNBlocks(decdecomp)); /*lint !e507*/
2397 assert(GCGdecompGetNLinkingvars(decdecomp) > 0 || GCGdecompGetNTotalStairlinkingvars(decdecomp) > 0);
2524 SCIP_Bool* consismaster, /**< array of flags whether a constraint belongs to the master problem */
2527 int* nextblock, /**< index of next free block to which no constraints have been assigned yet */
2632 SCIPdebugMessage("Cons %s will be in block %d (next %d)\n", SCIPconsGetName(cons), consblock, *nextblock);
2662 if( (blockrepresentative[oldblock] != -1) && (blockrepresentative[oldblock] > blockrepresentative[consblock]) )
2666 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldblock, blockrepresentative[oldblock], consblock);
2672 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldrepr, blockrepresentative[oldrepr], consblock);
2706 SCIP_Bool* consismaster, /**< array of flags whether a constraint belongs to the master problem */
2709 SCIP_HASHMAP* newconstoblock, /**< new hashmap from constraints to block numbers, to be filled */
2814 SCIP_CALL( assignConstraintsToRepresentatives(gcg, conss, nconss, consismaster, constoblock, vartoblock, &nextblock, blockrepresentative) );
2820 SCIP_CALL( fillConstoblock(conss, nconss, consismaster, nblocks, constoblock, newconstoblock, blockrepresentative) );
2836 int* nbinvars, /**< pointer to array of size nproblems to store number of binary subproblem vars */
2837 int* nintvars, /**< pointer to array of size nproblems to store number of integer subproblem vars */
2838 int* nimplvars, /**< pointer to array of size nproblems to store number of implied subproblem vars */
2839 int* ncontvars, /**< pointer to array of size nproblems to store number of continues subproblem vars */
2853 if( nintvars != NULL && (SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER && !SCIPvarIsBinary(var)) )
2872/** return the number of variables and binary, integer, implied integer, continuous variables of all subproblems */
2876 int* nvars, /**< pointer to array of size nproblems to store number of subproblem vars or NULL */
2877 int* nbinvars, /**< pointer to array of size nproblems to store number of binary subproblem vars or NULL */
2878 int* nintvars, /**< pointer to array of size nproblems to store number of integer subproblem vars or NULL */
2879 int* nimplvars, /**< pointer to array of size nproblems to store number of implied subproblem vars or NULL */
2921/** return the number of variables and binary, integer, implied integer, continuous variables of the master */
2963 * returns the number of nonzeros of each column of the constraint matrix both in the subproblem and in the master
2964 * @note For linking variables, the number of nonzeros in the subproblems corresponds to the number on nonzeros
2969 * @pre This function assumes that constraints are partitioned in the decomp structure, no constraint is present in more than one block
3030 assert(c < nconss); /* This assertion and the logic forbids constraints in more than one block */
3079 assert(c < nconss); /* This assertion and the logic forbids constraints in more than one block */
3104 SCIPdebugMessage("Var <%s> appears in cons <%s>, total count: %d\n", SCIPvarGetName(var), SCIPconsGetName(curconss[j]), varmasterdensity[probindex]);
3152 * calculates the number of up and down locks of variables for a given decomposition in both the original problem and the pricingproblems
3164 int** subsciplocksdown, /**< pointer to two dimensional array to store the down locks for the subproblems */
3165 int** subsciplocksup, /**< pointer to two dimensional array to store the down locks for the subproblems */
3243 increaseLock(gcg, lhs, curvals[v], rhs, &(subsciplocksdown[i][probindex]), &(subsciplocksup[i][probindex]));
3282 increaseLock(gcg, lhs, curvals[v], rhs, &(masterlocksdown[probindex]), &(masterlocksup[probindex]));
3293/** sets the score of the given decomposition based on the border, the average density score and the ratio of
3299 SCIP_Real maxwhitescore /**< score related to max white measure (i.e. fraction of white (nonblock and nonborder) matrix area ) */
3310/** computes the score of the given decomposition based on the border, the average density score and the ratio of
3328/** computes the score of the given decomposition based on the border, the average density score and the ratio of
3391 blackarea += ( GCGdecompGetNLinkingvars(decdecomp) - GCGdecompGetNMastervars(decdecomp) ) * nconss;
3394 blackarea -= (GCGdecompGetNLinkingvars(decdecomp) - GCGdecompGetNMastervars(decdecomp) ) * GCGdecompGetNLinkingconss(decdecomp);
3409 blackarea += GCGdecompGetNSubscipconss(decdecomp)[i] * ( GCGdecompGetNSubscipvars(decdecomp)[i] );
3445 block = (int)(size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decdecomp), curvars[k]); /*lint !e507*/
3450 block = (int)(size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decdecomp), var); /*lint !e507*/
3486 borderarea = (SCIP_Longint) GCGdecompGetNLinkingconss(decdecomp)*nvars + (SCIP_Longint) GCGdecompGetNLinkingvars(decdecomp)*(nconss-GCGdecompGetNLinkingconss(decdecomp));
3515 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + alphadensity*(score->densityscore);
3519 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + alphadensity*(score->densityscore);
3529 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + 0.2*(score->densityscore);
3533 SCIPerrorMessage("Decomposition type is %s, cannot compute score\n", GCGdecompGetStrType(GCGdecompGetType(decdecomp)));
3564 DEC_STATISTIC* blockvardensities, /**< array of statistic structs to store density information of each block */
3565 DEC_STATISTIC* mastervardensity, /**< pointer to store density information of master variables*/
3602 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vardistribution[b], GCGdecompGetNSubscipvars(decomp)[b]) ); /*lint !e866 !e666*/
3608 int block = ((int) (size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decomp), (vars[v]))) - 1; /*lint !e507 */
3618 vardistribution[block][nvardistribution[block]] = 1.0*varprobdensity[v]/GCGdecompGetNSubscipconss(decomp)[block];
3643 SCIPdebugPrintf(" <%s> %.3f", SCIPvarGetName(GCGdecompGetSubscipvars(decomp)[b][v]), vardistribution[b][v]);
3685 SCIPfreeBlockMemoryArray(scip, &vardistribution[b], GCGdecompGetNSubscipvars(decomp)[b]); /*lint !e866 */
3712/** computes nonzero elements of a given constraint, separated into linking variables and normal vars */
3758 block = ((int) (size_t) SCIPhashmapGetImage(GCGdecompGetVartoblock(decomp), (curvar))) - 1; /*lint !e507 */
3763 if( SCIPvarGetType(curvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(curvar) == SCIP_VARTYPE_INTEGER )
3770 if( SCIPvarGetType(curvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(curvar) == SCIP_VARTYPE_INTEGER )
3814 SCIP_CALL( computeConssNzeros(gcg, decomp, subscipconss[c], &(nonzeros[b]), &(intnzeros[b]), lnzeros, lintnzeros ) );
3820 SCIP_CALL( computeConssNzeros(gcg, decomp, GCGdecompGetLinkingconss(decomp)[c], mnzeros, mintnzeros, lnzeros, lintnzeros ) );
3911 GCGgetSubproblemVarsData(gcg, decomp, nallvars, nbinvars, nintvars, nimplvars, ncontvars, nblocks);
3912 GCGgetLinkingVarsData(gcg, decomp, &nlinkvars, &nlinkbinvar, &nlinkintvars, &nlinkimplvars, &nlinkcontvars);
3916 SCIP_CALL( GCGgetDensityData(gcg, decomp, vars, nvars, conss, nconss, varprobdensity, varmasterdensity, consprobsensity, consmasterdensity) );
3918 SCIP_CALL( computeVarDensities(gcg, decomp, varprobdensity, varmasterdensity, vars, nvars, blockvardensities, &mastervardensity, nblocks) );
3919 SCIP_CALL( computeNonzeros(gcg, decomp, &mnzeros, &mintnzeros, &lnzeros, &lintnzeros, nonzeros, intnzeros) );
3922 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " type : %10s\n", GCGdecompGetStrType(GCGdecompGetType(decomp)));
3923 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " detector : %10s\n", decomp->detectorchainstring == NULL? "provided": decomp->detectorchainstring);
3924 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " blocks : %10d\n", GCGdecompGetNBlocks(decomp));
3935 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " aggr. blocks : %10d\n", nblocksrelevant);
3937 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, "Master statistics : nlinkvars nstatvars nbinvars nintvars nimplvars ncontvars nconss nonzeros intnzeros bnzeros bintnzeros min(dens) max(dens) medi(dens) mean(dens)\n");
3938 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " master : %10d %10d %9d %9d %9d %10d %8d %9d %9d %9d %10d %9.3f %9.3f %10.3f %9.3f\n", nlinkvars, nstaticvars,
3940 mnzeros, mintnzeros, lnzeros, lintnzeros, mastervardensity.min, mastervardensity.max, mastervardensity.median, mastervardensity.mean);
3942 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, "Pricing statistics : nvars nbinvars nintvars nimplvars ncontvars nconss nonzeros intnzeros min(dens) max(dens) medi(dens) mean(dens) identical\n");
3955 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " %10d : %10d %10d %10d %10d %10d %10d %10d %10d %10.3f %10.3f %10.3f %10.3f %10d\n", b+1, nallvars[b], nbinvars[b], nintvars[b], nimplvars[b], ncontvars[b],
3956 GCGdecompGetNSubscipconss(decomp)[b], nonzeros[b], intnzeros[b], blockvardensities[b].min, blockvardensities[b].max, blockvardensities[b].median, blockvardensities[b].mean, identical);
3961 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " border area : %10.3f\n", scores.borderscore);
3962 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " avg. density : %10.3f\n", scores.densityscore);
3963 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(origprob), file, " linking score : %10.3f\n", scores.linkingscore);
4041 if( SCIPhashmapGetImage(constoblock1, conss[i]) != SCIPhashmapGetImage(constoblock2, conss[i]) )
4090/** returns the number of the block that the constraint is with respect to the decomposition; set
4092 * *block = -1, if it has only variables belonging only to the master (meaning that this constraint should build a new block)
4093 * *block in [0,...,nblocks-1] if it only contains variables of a particular block (plus linking variables)
4095 * - either variables from more than one block (plus linking variables or master only variables)
4217 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decomp->subscipconss[block], oldsize, newsize) ); /*lint !e866 */
4221 SCIP_CALL( SCIPhashmapSetImage(decomp->constoblock, linkcons, (void*) (size_t)((size_t)block+1)) );
4271 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingconss, SCIPcalcMemGrowSize(scip, linkingconssize));
4310 SCIPdebugMessage("Cons <%s> in new pricing problem\n", SCIPconsGetName(decomp->linkingconss[c]));
4328 SCIP_CALL( GCGfilloutDecompFromConstoblock(gcg, *newdecomp, constoblock, decomp->nblocks+1, FALSE) );
4336/** polish the decomposition and try to greedily assign master constraints to pricing problem where useful */
4361 SCIP_CALL( GCGdecompTryAssignMasterconssToExistingPricing(gcg, *newdecomp, &transferredexisting) );
4363 SCIP_CALL( GCGdecompTryAssignMasterconssToNewPricing(gcg, *newdecomp, &tempdecomp, &transferrednew) );
4415 SCIPrandomPermuteArray(randnumgen, (void**)linkingconss, 0, GCGdecompGetNLinkingconss(decomp));
SCIP_VAR ** b
int GCGconshdlrDecompDecreaseNCallsCreateDecomp(GCG *gcg)
decreases the counter for created decompositions and returns it
Definition cons_decomp.cpp:3742
int GCGconshdlrDecompIncreaseNCallsCreateDecomp(GCG *gcg)
counts up the counter for created decompositions and returns it
Definition cons_decomp.cpp:4456
constraint handler for structure detection
GCG_EXPORT SCIP_RETCODE GCGdecompSetDetectorChainString(GCG *gcg, GCG_DECOMP *decomp, const char *detectorchainstring)
Definition decomp.c:1730
void GCGdecompSetConsindex(GCG_DECOMP *decomp, SCIP_HASHMAP *consindex)
Definition decomp.c:1273
SCIP_Real * GCGdecompGetDetectorClockTimes(GCG_DECOMP *decomp)
Definition decomp.c:1721
SCIP_RETCODE GCGdetermineConsBlock(GCG *gcg, GCG_DECOMP *decomp, SCIP_CONS *cons, int *block)
Definition decomp.c:4100
GCG_EXPORT SCIP_Real * GCGdecompGetDetectorPctConssToBlock(GCG_DECOMP *decomp)
Definition decomp.c:1886
void GCGdecompSetPresolved(GCG_DECOMP *decomp, SCIP_Bool presolved)
Definition decomp.c:724
void GCGdecompSetMaxWhiteScore(GCG *gcg, GCG_DECOMP *decdecomp, SCIP_Real maxwhitescore)
Definition decomp.c:3296
GCG_DETECTOR ** GCGdecompGetDetectorChain(GCG_DECOMP *decomp)
Definition decomp.c:1626
void GCGdecompSetDetector(GCG_DECOMP *decomp, GCG_DETECTOR *detector)
Definition decomp.c:1605
SCIP_VAR *** GCGdecompGetStairlinkingvars(GCG_DECOMP *decomp)
Definition decomp.c:1173
SCIP_VAR ** GCGdecompGetLinkingvars(GCG_DECOMP *decomp)
Definition decomp.c:1056
static SCIP_RETCODE computeConssNzeros(GCG *gcg, GCG_DECOMP *decomp, SCIP_CONS *cons, int *nzeros, int *nintzeros, int *nbzeros, int *nintbzeros)
Definition decomp.c:3714
SCIP_RETCODE GCGcreateBasicDecomp(GCG *gcg, GCG_DECOMP **decomp, SCIP_Bool solveorigprob)
Definition decomp.c:2418
SCIP_RETCODE GCGdecompCheckConsistency(GCG *gcg, GCG_DECOMP *decdecomp)
Definition decomp.c:2297
SCIP_RETCODE GCGcreateDecompFromMasterconss(GCG *gcg, GCG_DECOMP **decomp, SCIP_CONS **masterconss, int nmasterconss)
Definition decomp.c:2748
void GCGdecompSetVarindex(GCG_DECOMP *decomp, SCIP_HASHMAP *varindex)
Definition decomp.c:1253
static SCIP_RETCODE fillOutConsFromConstoblock(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_CONS **conss, int nconss, SCIP_Bool *haslinking)
Definition decomp.c:245
SCIP_CONS *** GCGdecompGetSubscipconss(GCG_DECOMP *decomp)
Definition decomp.c:924
SCIP_HASHMAP * GCGdecompGetConstoblock(GCG_DECOMP *decomp)
Definition decomp.c:1243
SCIP_RETCODE GCGprintDecompStatistics(GCG *gcg, FILE *file, GCG_DECOMP *decomp)
Definition decomp.c:3827
SCIP_Real * GCGdecompGetDetectorPctConssToBorder(GCG_DECOMP *decomp)
Definition decomp.c:1816
static void increaseLock(GCG *gcg, SCIP_Real lhs, SCIP_Real coef, SCIP_Real rhs, int *downlock, int *uplock)
Definition decomp.c:3118
SCIP_Bool GCGdecompositionsAreEqual(GCG *gcg, GCG_DECOMP *decomp1, GCG_DECOMP *decomp2)
Definition decomp.c:3990
SCIP_RETCODE GCGdecompSetType(GCG_DECOMP *decomp, GCG_DECTYPE type)
Definition decomp.c:659
SCIP_RETCODE GCGdecompAddRemainingConss(GCG *gcg, GCG_DECOMP *decdecomp)
Definition decomp.c:2206
SCIP_RETCODE GCGfilloutDecompFromConstoblock(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition decomp.c:1479
SCIP_RETCODE GCGdecompTryAssignMasterconssToNewPricing(GCG *gcg, GCG_DECOMP *decomp, GCG_DECOMP **newdecomp, int *transferred)
Definition decomp.c:4279
SCIP_RETCODE GCGdecompCreate(GCG *gcg, GCG_DECOMP **decdecomp)
Definition decomp.c:480
SCIP_RETCODE GCGdecompSetSubscipvars(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR ***subscipvars, int *nsubscipvars)
Definition decomp.c:767
SCIP_Real * GCGdecompGetDetectorPctVarsFromOpen(GCG_DECOMP *decomp)
Definition decomp.c:1924
SCIP_RETCODE GCGdecompRemoveDeletedConss(GCG *gcg, GCG_DECOMP *decdecomp)
Definition decomp.c:2148
SCIP_RETCODE GCGcreatePolishedDecomp(GCG *gcg, GCG_DECOMP *decomp, GCG_DECOMP **newdecomp)
Definition decomp.c:4337
SCIP_RETCODE GCGfilloutDecompFromHashmaps(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *vartoblock, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition decomp.c:1293
SCIP_CONS ** GCGdecompGetLinkingconss(GCG_DECOMP *decomp)
Definition decomp.c:985
void GCGdecompSetNNewBlocks(GCG *gcg, GCG_DECOMP *decomp, int *nNewBlocks)
Definition decomp.c:1970
void GCGgetLinkingVarsData(GCG *gcg, GCG_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition decomp.c:2922
static SCIP_RETCODE computeVarDensities(GCG *gcg, GCG_DECOMP *decomp, int *varprobdensity, int *varmasterdensity, SCIP_VAR **vars, int nvars, DEC_STATISTIC *blockvardensities, DEC_STATISTIC *mastervardensity, int nblocks)
Definition decomp.c:3557
SCIP_RETCODE GCGdecompTryAssignMasterconssToExistingPricing(GCG *gcg, GCG_DECOMP *decomp, int *transferred)
Definition decomp.c:4229
GCG_EXPORT char * GCGdecompGetDetectorChainString(GCG *gcg, GCG_DECOMP *decomp)
Definition decomp.c:1745
static SCIP_RETCODE computeNonzeros(GCG *gcg, GCG_DECOMP *decomp, int *mnzeros, int *mintnzeros, int *lnzeros, int *lintnzeros, int *nonzeros, int *intnzeros)
Definition decomp.c:3785
SCIP_RETCODE GCGdecompSetLinkingvars(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR **linkingvars, int nlinkingvars, int nfixedlinkingvars, int nmastervars)
Definition decomp.c:1007
int GCGdecompGetNTotalStairlinkingvars(GCG_DECOMP *decomp)
Definition decomp.c:1192
void GCGdecompSetVartoblock(GCG_DECOMP *decomp, SCIP_HASHMAP *vartoblock)
Definition decomp.c:1209
void GCGdecompSetPartialdecID(GCG_DECOMP *decomp, int id)
Definition decomp.c:1673
SCIP_RETCODE GCGdecompSetStairlinkingvars(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR ***stairlinkingvars, int *nstairlinkingvars)
Definition decomp.c:1101
void GCGdecompSetDetectorPctVarsToBorder(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctVarsToBorder)
Definition decomp.c:1754
SCIP_HASHMAP * GCGdecompGetVartoblock(GCG_DECOMP *decomp)
Definition decomp.c:1221
SCIP_HASHMAP * GCGdecompGetConsindex(GCG_DECOMP *decomp)
Definition decomp.c:1284
void GCGdecompSetDetectorPctConssFromOpen(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctConssFromOpen)
Definition decomp.c:1932
static SCIP_RETCODE fillConstoblock(SCIP_CONS **conss, int nconss, SCIP_Bool *consismaster, int nblocks, SCIP_HASHMAP *constoblock, SCIP_HASHMAP *newconstoblock, int *blockrepresentative)
Definition decomp.c:2703
static SCIP_RETCODE assignConsvarsToBlock(GCG *gcg, GCG_DECOMP *decomp, SCIP_CONS *cons, int block)
Definition decomp.c:417
SCIP_RETCODE GCGdecompSetSubscipconss(GCG *gcg, GCG_DECOMP *decomp, SCIP_CONS ***subscipconss, int *nsubscipconss)
Definition decomp.c:857
SCIP_RETCODE GCGdecompSetLinkingconss(GCG *gcg, GCG_DECOMP *decomp, SCIP_CONS **linkingconss, int nlinkingconss)
Definition decomp.c:942
void GCGdecompSetDetectorPctVarsFromOpen(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctVarsFromOpen)
Definition decomp.c:1895
void GCGdecompSetDetectorPctVarsToBlock(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctVarsToBlock)
Definition decomp.c:1824
SCIP_Real GCGdecompGetMaxwhiteScore(GCG_DECOMP *decomp)
Definition decomp.c:713
static int processBlockRepresentatives(int maxblock, int *blockrepresentative)
Definition decomp.c:2485
SCIP_RETCODE GCGdecompEvaluateDecomposition(GCG *gcg, GCG_DECOMP *decdecomp, DEC_SCORES *score)
Definition decomp.c:3331
void GCGdecompSetDetectorClockTimes(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *detectorClockTimes)
Definition decomp.c:1694
SCIP_Real * GCGdecompGetDetectorPctVarsToBlock(GCG_DECOMP *decomp)
Definition decomp.c:1850
static SCIP_Real quick_select_median(SCIP_Real arr[], int n)
Definition decomp.c:63
static SCIP_RETCODE fillOutVarsFromVartoblock(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *vartoblock, int nblocks, SCIP_VAR **vars, int nvars, SCIP_Bool *haslinking)
Definition decomp.c:124
SCIP_VAR *** GCGdecompGetSubscipvars(GCG_DECOMP *decomp)
Definition decomp.c:837
void GCGdecompSetDetectorPctConssToBlock(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctConssToBlock)
Definition decomp.c:1858
void GCGdecompSetDetectorPctConssToBorder(GCG *gcg, GCG_DECOMP *decomp, SCIP_Real *pctConssToBorder)
Definition decomp.c:1788
SCIP_RETCODE GCGpermuteDecomp(GCG *gcg, GCG_DECOMP *decomp, SCIP_RANDNUMGEN *randnumgen)
Definition decomp.c:4384
SCIP_Real * GCGdecompGetDetectorPctConssFromOpen(GCG_DECOMP *decomp)
Definition decomp.c:1962
int GCGfilterSimilarDecompositions(GCG *gcg, GCG_DECOMP **decs, int ndecs)
Definition decomp.c:4057
int GCGdecompGetNFixedLinkingvars(GCG_DECOMP *decomp)
Definition decomp.c:1077
SCIP_RETCODE GCGgetDensityData(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, int *varsubproblemdensity, int *varmasterdensity, int *conssubproblemdensity, int *consmasterdensity)
Definition decomp.c:2972
void GCGgetSubproblemVarsData(GCG *gcg, GCG_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars, int nproblems)
Definition decomp.c:2873
SCIP_RETCODE GCGdecompMoveLinkingConsToPricing(GCG *gcg, GCG_DECOMP *decomp, int consindex, int block)
Definition decomp.c:4192
int * GCGdecompGetNStairlinkingvars(GCG_DECOMP *decomp)
Definition decomp.c:1182
static SCIP_RETCODE removeFromLinkingvars(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR *var, SCIP_Bool *success)
Definition decomp.c:360
SCIP_RETCODE GCGgetVarLockData(GCG *gcg, GCG_DECOMP *decomp, SCIP_VAR **vars, int nvars, int nsubproblems, int **subsciplocksdown, int **subsciplocksup, int *masterlocksdown, int *masterlocksup)
Definition decomp.c:3158
SCIP_RETCODE GCGdecompSetDetectorChain(GCG *gcg, GCG_DECOMP *decomp, GCG_DETECTOR **detectors, int ndetectors)
Definition decomp.c:1635
int GCGdecompGetDetectorChainSize(GCG_DECOMP *decomp)
Definition decomp.c:1663
SCIP_Real GCGdecompGetMaxWhiteScore(GCG *gcg, GCG_DECOMP *decdecomp)
Definition decomp.c:3313
SCIP_RETCODE GCGdecompTransform(GCG *gcg, GCG_DECOMP *decomp)
Definition decomp.c:2005
void GCGdecompSetConstoblock(GCG_DECOMP *decomp, SCIP_HASHMAP *constoblock)
Definition decomp.c:1231
GCG_EXPORT SCIP_Real * GCGdecompGetDetectorPctVarsToBorder(GCG_DECOMP *decomp)
Definition decomp.c:1780
static void incVarsData(SCIP_VAR *var, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars, int nproblems, int i)
Definition decomp.c:2834
static SCIP_RETCODE assignConstraintsToRepresentatives(GCG *gcg, SCIP_CONS **conss, int nconss, SCIP_Bool *consismaster, SCIP_HASHMAP *constoblock, int *vartoblock, int *nextblock, int *blockrepresentative)
Definition decomp.c:2520
private methods for working with decomp structures
#define SCIP_MAXSTRLEN
#define SCIP_Longint
#define SCIP_Bool
#define SCIP_CALL_QUIET(x)
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define SCIP_CALL_ABORT(x)
#define TRUE
#define FALSE
GCG interface methods.
GCG_EXPORT int GCGgetNIdenticalBlocks(GCG *gcg, int pricingprobnr)
Definition relax_gcg.c:4185
GCG_EXPORT SCIP_Bool GCGisPricingprobRelevant(GCG *gcg, int pricingprobnr)
Definition relax_gcg.c:4132
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition scip_misc.c:487
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition scip_misc.c:618
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randnumgen, void **array, int begin, int end)
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeMemoryNull(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPfreeBufferArrayNull(scip, ptr)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarIsDeleted(SCIP_VAR *var)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetProbvar(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, 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
#define BMScopyMemoryArray(ptr, source, num)
#define BMSclearMemoryArray(ptr, num)
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition class_conspartition.cpp:44
INLINE Rational & max(Rational &r1, Rational &r2)
INLINE Rational & min(Rational &r1, Rational &r2)
#define SCIPerrorMessage
#define SCIPdebugPrintf
GCG relaxator.
various SCIP helper methods
Definition decomp.c:53
structure information for decomposition information in GCG projects
struct SCIP_Cons SCIP_CONS
SCIP_VERBLEVEL_FULL
struct SCIP_HashMap SCIP_HASHMAP
struct SCIP_RandNumGen SCIP_RANDNUMGEN
SCIP_INVALIDDATA
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_PRESOLVING
SCIP_STAGE_TRANSFORMED
SCIP_STAGE_INITSOLVE
SCIP_STAGE_PRESOLVED
struct SCIP_Var SCIP_VAR
SCIP_IMPLINTTYPE_NONE
SCIP_VARTYPE_INTEGER
SCIP_VARTYPE_CONTINUOUS
SCIP_VARTYPE_BINARY
SCIP_VARSTATUS_FIXED