decomp.c
Go to the documentation of this file.
37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
386 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingvars, SCIPcalcMemGrowSize(scip, linkingvarsize));
406 /** for a given constraint, check which of its variables were previously determined to be copied directly to the master,
441 if( (int) (size_t) SCIPhashmapGetImage(decomp->vartoblock, probvar) == decomp->nblocks+1 ) /*lint !e507 */
448 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decomp->subscipvars[block], oldsize, newsize) ) /*lint !e866 */;
524 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "ncalls of createdecompfrompartialdec: %d \n", ncalls);
558 SCIPfreeBlockMemoryArrayNull(scip, &(decomp->subscipvars[i]), SCIPcalcMemGrowSize(scip, decomp->nsubscipvars[i])); /*lint !e866*/
570 SCIPfreeBlockMemoryArrayNull(scip, &decomp->subscipconss[i], SCIPcalcMemGrowSize(scip, decomp->nsubscipconss[i])); /*lint !e866*/
598 SCIPfreeBlockMemoryArrayNull(scip, &decomp->stairlinkingvars[i], SCIPcalcMemGrowSize(scip, decomp->nstairlinkingvars[i])); /*lint !e866*/
619 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingvars, SCIPcalcMemGrowSize(scip, decomp->nlinkingvars));
622 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingconss, SCIPcalcMemGrowSize(scip, decomp->nlinkingconss));
625 SCIPfreeBlockMemoryArrayNull(scip, &decomp->detectorchain, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
626 SCIPfreeBlockMemoryArrayNull(scip, &decomp->detectorclocktimes, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
627 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarstoborder, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
628 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconsstoborder, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
629 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarstoblock, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
630 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconsstoblock, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
631 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctvarsfromopen, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
632 SCIPfreeBlockMemoryArrayNull(scip, &decomp->pctconssfromopen, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
633 SCIPfreeBlockMemoryArrayNull(scip, &decomp->nnewblocks, SCIPcalcMemGrowSize(scip,decomp->sizedetectorchain ) );
641 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "ncalls of createdecompfrompartialdec: %d \n", ncalls);
880 SCIPerrorMessage("Block %d is empty and thus invalid. Each block needs at least one constraint.\n", b);
960 SCIPerrorMessage("Number of linking constraints and linking constraint array are inconsistent.\n");
1027 SCIPerrorMessage("Number of linking variables and linking variable array are inconsistent.\n");
1068 /** returns the number of linking variables that are purely master ("static") variables of the given decomposition */
1106 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &decomp->stairlinkingvars, decomp->nblocks) ); /* this is more efficient */
1107 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &decomp->nstairlinkingvars, decomp->nblocks) ); /* this is more efficient */
1122 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(decomp->stairlinkingvars[b]), size) ); /*lint !e866 */
1123 BMScopyMemoryArray(decomp->stairlinkingvars[b], stairlinkingvars[b], nstairlinkingvars[b]); /*lint !e866 */
1319 SCIP_CALL_QUIET( fillOutConsFromConstoblock(scip, decomp, constoblock, nblocks, conss, nconss, &haslinking) );
1327 SCIP_CALL( fillOutVarsFromVartoblock(scip, decomp, vartoblock, nblocks, vars, nvars, &haslinking) );
1448 /** completely fills out decomposition structure from only the constraint partition in the following manner:
1449 * given constraint block/border assignment (by constoblock), one gets the following assignment of probvars:
1451 * (i) constoblock(i) iff constoblock(i1) == constoblock(i2) for all i1,i2 in C(j) with constoblock(i1) != nblocks+1 && constoblock(i2) != nblocks+1
1452 * (ii) nblocks+2 ["linking var"] iff exists i1,i2 with constoblock(i1) != constoblock(i2) && constoblock(i1) != nblocks+1 && constoblock(i2) != nblocks+1
1458 SCIP_HASHMAP* constoblock, /**< constraint to block hashmap, start with 1 for first block and nblocks+1 for linking constraints */
1516 SCIPdebugMessage("cons <%s> (%d vars) is in block %d.\n", SCIPconsGetName(conss[i]), ncurvars, consblock);
1537 SCIPdebugMessage(" var <%s> not been handled before, adding to block %d\n", SCIPvarGetName(probvar), consblock);
1544 SCIPdebugMessage(" var <%s> has been handled before, adding to linking (%d != %d)\n", SCIPvarGetName(probvar), consblock, varblock);
1551 SCIPdebugMessage(" var <%s> is handled and in same block as cons (%d == %d).\n", SCIPvarGetName(probvar), consblock, varblock);
1558 /* Handle variables that do not appear in any pricing problem, those will be copied directly to the master */
1568 retcode = DECfilloutDecompFromHashmaps(scip, decomp, vartoblock, constoblock, nblocks, staircase && haslinking);
1708 const char* detectorchainstring /**< string for the detector information working on that decomposition */
1711 SCIP_CALL (SCIPduplicateBlockMemoryArray(scip, &(decomp->detectorchainstring), detectorchainstring, SCIP_MAXSTRLEN ) );
1727 /** sets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1754 /** gets the percentages of variables assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1763 /** sets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1790 /** gets the percentages of constraints assigned to the border of the corresponding detectors (of the detector chain) on this decomposition */
1798 /** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1802 SCIP_Real* pctVarsToBlock /**< percentage of variables assigned to some block in the detector chain */
1825 /** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1833 /** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1837 SCIP_Real* pctConssToBlock /**< percentage of constraints assigned to some block in the detector chain */
1860 /** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1870 /** sets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1874 SCIP_Real* pctVarsFromOpen /**< percentage of open variables assigned to some block in the detector chain */
1898 /** gets the percentages of variables assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1906 /** sets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain) on this decomposition */
1910 SCIP_Real* pctConssFromOpen /**< percentage of open variables assigned to some block in the detector chain */
1934 /** gets the percentages of constraints assigned to some block of the corresponding detectors (of the detector chain)
1943 /** sets the number of new blocks of the corresponding detectors (of the detector chain) on this decomposition */
1969 /** gets the number of new blocks corresponding detectors (of the detector chain) on this decomposition */
2006 (void*) decomp->subscipconss[b][c], SCIPconsIsTransformed(decomp->subscipconss[b][c])?"t":"o" );
2017 SCIP_CALL( SCIPhashmapSetImage(newconstoblock, decomp->subscipconss[b][c], (void*) (size_t) (b+1)) );
2041 /* the probvar can also be fixed, in which case we do not need it in the block; furthermore, multiple variables
2042 * can resolve to the same active problem variable, so we check whether we already handled the variable
2050 (void*)decomp->subscipvars[b][idx], SCIPvarIsTransformed(decomp->subscipvars[b][idx])?"t":"o" );
2054 SCIP_CALL( SCIPhashmapSetImage(newvartoblock, decomp->subscipvars[b][idx], (void*) (size_t) (b+1)) );
2066 SCIPdebugMessage("m, %d: %s (%s)\n", c, SCIPconsGetName(decomp->linkingconss[c]), SCIPconsIsTransformed(decomp->linkingconss[c])?"t":"o" );
2075 SCIP_CALL( SCIPhashmapSetImage(newconstoblock, decomp->linkingconss[c],(void*) (size_t) (decomp->nblocks+1) ) );
2096 block = (int) (size_t) SCIPhashmapGetImage(decomp->vartoblock, decomp->linkingvars[v]); /*lint !e507*/
2104 SCIP_CALL( SCIPhashmapSetImage(newvartoblock, decomp->linkingvars[v], (void*) (size_t) (block) ) );
2121 * Remove all those constraints that were removed from the problem after the decomposition had been created
2177 * Adds all those constraints that were added to the problem after the decomposition had been created
2199 SCIPdebugMessage("add remaining: cons <%s> in block %d/%d\n", SCIPconsGetName(cons), block, DECdecompGetNBlocks(decdecomp) );
2216 SCIPwarningMessage(scip, "Decomposition type changed to 'bordered' due to an added constraint.\n");
2220 SCIPwarningMessage(scip, "Decomposition type changed to 'arrowhead' due to an added constraint.\n");
2236 SCIP_CALL( SCIPhashmapInsert(decdecomp->constoblock, cons, (void*) (size_t) (DECdecompGetNBlocks(decdecomp)+1)) );
2248 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decdecomp->subscipconss[block], oldsize, newsize) ); /*lint !e866*/
2278 SCIPdebugMessage("Problem is %stransformed\n", SCIPgetStage(scip) >= SCIP_STAGE_TRANSFORMED ? "": "not ");
2282 if( SCIPisEQ(scip, SCIPvarGetLbGlobal(SCIPgetVars(scip)[v]), SCIPvarGetUbGlobal(SCIPgetVars(scip)[v]) ) && SCIPisEQ(scip, SCIPvarGetUbGlobal(SCIPgetVars(scip)[v]), 0. ) )
2304 SCIPdebugMessage("Cons <%s> in block %d = %d\n", SCIPconsGetName(cons), b, ((int) (size_t) SCIPhashmapGetImage(DECdecompGetConstoblock(decdecomp), cons)) -1); /*lint !e507*/
2308 assert(((int) (size_t) SCIPhashmapGetImage(DECdecompGetConstoblock(decdecomp), cons)) - 1 == b); /*lint !e507*/
2320 if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_FIXED || SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var) )
2323 varblock = ((int) (size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decdecomp), var)) - 1; /*lint !e507*/
2334 assert((DECdecompGetSubscipvars(decdecomp)[b] == NULL) == (DECdecompGetNSubscipvars(decdecomp)[b] == 0));
2341 varblock = ((int) (size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decdecomp), var)) - 1; /*lint !e507*/
2353 varblock = (int) (size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decdecomp), DECdecompGetLinkingvars(decdecomp)[v]); /*lint !e507*/
2354 assert( varblock == DECdecompGetNBlocks(decdecomp) +1 || varblock == DECdecompGetNBlocks(decdecomp)+2); /*lint !e507*/
2358 assert(((int) (size_t) SCIPhashmapGetImage(DECdecompGetConstoblock(decdecomp), DECdecompGetLinkingconss(decdecomp)[c])) -1 == DECdecompGetNBlocks(decdecomp)); /*lint !e507*/
2367 assert(DECdecompGetNLinkingvars(decdecomp) > 0 || DECdecompGetNTotalStairlinkingvars(decdecomp) > 0);
2492 SCIP_Bool* consismaster, /**< array of flags whether a constraint belongs to the master problem */
2495 int* nextblock, /**< index of next free block to which no constraints have been assigned yet */
2599 SCIPdebugMessage("Cons %s will be in block %d (next %d)\n", SCIPconsGetName(cons), consblock, *nextblock);
2629 if( (blockrepresentative[oldblock] != -1) && (blockrepresentative[oldblock] > blockrepresentative[consblock]) )
2633 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldblock, blockrepresentative[oldblock], consblock);
2639 SCIPdebugMessage("\t\tBlock representative from block %d changed from %d to %d.\n", oldrepr, blockrepresentative[oldrepr], consblock);
2673 SCIP_Bool* consismaster, /**< array of flags whether a constraint belongs to the master problem */
2676 SCIP_HASHMAP* newconstoblock, /**< new hashmap from constraints to block numbers, to be filled */
2778 SCIP_CALL( assignConstraintsToRepresentatives(scip, conss, nconss, consismaster, constoblock, vartoblock, &nextblock, blockrepresentative) );
2784 SCIP_CALL( fillConstoblock(conss, nconss, consismaster, nblocks, constoblock, newconstoblock, blockrepresentative) );
2800 int* nbinvars, /**< pointer to array of size nproblems to store number of binary subproblem vars */
2801 int* nintvars, /**< pointer to array of size nproblems to store number of integer subproblem vars */
2802 int* nimplvars, /**< pointer to array of size nproblems to store number of implied subproblem vars */
2803 int* ncontvars, /**< pointer to array of size nproblems to store number of continues subproblem vars */
2817 if( nintvars != NULL && (SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER && !SCIPvarIsBinary(var)) )
2836 /** return the number of variables and binary, integer, implied integer, continuous variables of all subproblems */
2840 int* nvars, /**< pointer to array of size nproblems to store number of subproblem vars or NULL */
2841 int* nbinvars, /**< pointer to array of size nproblems to store number of binary subproblem vars or NULL */
2842 int* nintvars, /**< pointer to array of size nproblems to store number of integer subproblem vars or NULL */
2843 int* nimplvars, /**< pointer to array of size nproblems to store number of implied subproblem vars or NULL */
2844 int* ncontvars, /**< pointer to array of size nproblems to store number of continuous subproblem vars or NULL */
2885 /** return the number of variables and binary, integer, implied integer, continuous variables of the master */
2927 * returns the number of nonzeros of each column of the constraint matrix both in the subproblem and in the master
2928 * @note For linking variables, the number of nonzeros in the subproblems corresponds to the number on nonzeros
2933 * @pre This function assumes that constraints are partitioned in the decomp structure, no constraint is present in more than one block
2991 assert(c < nconss); /* This assertion and the logic forbids constraints in more than one block */
3040 assert(c < nconss); /* This assertion and the logic forbids constraints in more than one block */
3065 SCIPdebugMessage("Var <%s> appears in cons <%s>, total count: %d\n", SCIPvarGetName(var), SCIPconsGetName(curconss[j]), varmasterdensity[probindex]);
3111 * calculates the number of up and down locks of variables for a given decomposition in both the original problem and the pricingproblems
3123 int** subsciplocksdown, /**< pointer to two dimensional array to store the down locks for the subproblems */
3124 int** subsciplocksup, /**< pointer to two dimensional array to store the down locks for the subproblems */
3200 increaseLock(scip, lhs, curvals[v], rhs, &(subsciplocksdown[i][probindex]), &(subsciplocksup[i][probindex]));
3239 increaseLock(scip, lhs, curvals[v], rhs, &(masterlocksdown[probindex]), &(masterlocksup[probindex]));
3250 /** sets the score of the given decomposition based on the border, the average density score and the ratio of
3256 SCIP_Real maxwhitescore /**< score related to max white measure (i.e. fraction of white (nonblock and nonborder) matrix area ) */
3267 /** computes the score of the given decomposition based on the border, the average density score and the ratio of
3285 /** computes the score of the given decomposition based on the border, the average density score and the ratio of
3346 blackarea += ( DECdecompGetNLinkingvars(decdecomp) - DECdecompGetNMastervars(decdecomp) ) * nconss;
3349 blackarea -= (DECdecompGetNLinkingvars(decdecomp) - DECdecompGetNMastervars(decdecomp) ) * DECdecompGetNLinkingconss(decdecomp);
3364 blackarea += DECdecompGetNSubscipconss(decdecomp)[i] * ( DECdecompGetNSubscipvars(decdecomp)[i] );
3400 block = (int)(size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decdecomp), curvars[k]); /*lint !e507*/
3405 block = (int)(size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decdecomp), var); /*lint !e507*/
3441 borderarea = (SCIP_Longint) DECdecompGetNLinkingconss(decdecomp)*nvars + (SCIP_Longint) DECdecompGetNLinkingvars(decdecomp)*(nconss-DECdecompGetNLinkingconss(decdecomp));
3470 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + alphadensity*(score->densityscore);
3474 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + alphadensity*(score->densityscore);
3484 score->totalscore = alphaborderarea*(score->borderscore) + alphalinking*(score->linkingscore) + 0.2*(score->densityscore);
3488 SCIPerrorMessage("Decomposition type is %s, cannot compute score\n", DECgetStrType(DECdecompGetType(decdecomp)));
3519 DEC_STATISTIC* blockvardensities, /**< array of statistic structs to store density information of each block */
3520 DEC_STATISTIC* mastervardensity, /**< pointer to store density information of master variables*/
3555 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vardistribution[b], DECdecompGetNSubscipvars(decomp)[b]) ); /*lint !e866 !e666*/
3561 int block = ((int) (size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decomp), (vars[v]))) - 1; /*lint !e507 */
3571 vardistribution[block][nvardistribution[block]] = 1.0*varprobdensity[v]/DECdecompGetNSubscipconss(decomp)[block];
3596 SCIPdebugPrintf(" <%s> %.3f", SCIPvarGetName(DECdecompGetSubscipvars(decomp)[b][v]), vardistribution[b][v]);
3638 SCIPfreeBlockMemoryArray(scip, &vardistribution[b], DECdecompGetNSubscipvars(decomp)[b]); /*lint !e866 */
3665 /** computes nonzero elements of a given constraint, separated into linking variables and normal vars */
3709 block = ((int) (size_t) SCIPhashmapGetImage(DECdecompGetVartoblock(decomp), (curvar))) - 1; /*lint !e507 */
3714 if( SCIPvarGetType(curvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(curvar) == SCIP_VARTYPE_INTEGER )
3721 if( SCIPvarGetType(curvar) == SCIP_VARTYPE_BINARY || SCIPvarGetType(curvar) == SCIP_VARTYPE_INTEGER )
3765 SCIP_CALL( computeConssNzeros(scip, decomp, subscipconss[c], &(nonzeros[b]), &(intnzeros[b]), lnzeros, lintnzeros ) );
3771 SCIP_CALL( computeConssNzeros(scip, decomp, DECdecompGetLinkingconss(decomp)[c], mnzeros, mintnzeros, lnzeros, lintnzeros ) );
3860 DECgetSubproblemVarsData(scip, decomp, nallvars, nbinvars, nintvars, nimplvars, ncontvars, nblocks);
3861 DECgetLinkingVarsData(scip, decomp, &nlinkvars, &nlinkbinvar, &nlinkintvars, &nlinkimplvars, &nlinkcontvars);
3865 SCIP_CALL( DECgetDensityData(scip, decomp, vars, nvars, conss, nconss, varprobdensity, varmasterdensity, consprobsensity, consmasterdensity) );
3867 SCIP_CALL( computeVarDensities(scip, decomp, varprobdensity, varmasterdensity, vars, nvars, blockvardensities, &mastervardensity, nblocks) );
3868 SCIP_CALL( computeNonzeros(scip, decomp, &mnzeros, &mintnzeros, &lnzeros, &lintnzeros, nonzeros, intnzeros) );
3871 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " type : %10s\n", DECgetStrType(DECdecompGetType(decomp)));
3872 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " detector : %10s\n", decomp->detectorchainstring == NULL? "provided": decomp->detectorchainstring);
3873 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " blocks : %10d\n", DECdecompGetNBlocks(decomp));
3884 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " aggr. blocks : %10d\n", nblocksrelevant);
3886 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "Master statistics : nlinkvars nstatvars nbinvars nintvars nimplvars ncontvars nconss nonzeros intnzeros bnzeros bintnzeros min(dens) max(dens) medi(dens) mean(dens)\n");
3887 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " master : %10d %10d %9d %9d %9d %10d %8d %9d %9d %9d %10d %9.3f %9.3f %10.3f %9.3f\n", nlinkvars, nstaticvars,
3889 mnzeros, mintnzeros, lnzeros, lintnzeros, mastervardensity.min, mastervardensity.max, mastervardensity.median, mastervardensity.mean);
3891 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "Pricing statistics : nvars nbinvars nintvars nimplvars ncontvars nconss nonzeros intnzeros min(dens) max(dens) medi(dens) mean(dens) identical\n");
3904 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), 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],
3905 DECdecompGetNSubscipconss(decomp)[b], nonzeros[b], intnzeros[b], blockvardensities[b].min, blockvardensities[b].max, blockvardensities[b].median, blockvardensities[b].mean, identical);
3910 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " border area : %10.3f\n", scores.borderscore);
3911 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " avg. density : %10.3f\n", scores.densityscore);
3912 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, " linking score : %10.3f\n", scores.linkingscore);
3988 if( SCIPhashmapGetImage(constoblock1, conss[i]) != SCIPhashmapGetImage(constoblock2, conss[i]) )
4037 /** returns the number of the block that the constraint is with respect to the decomposition; set
4039 * *block = -1, if it has only variables belonging only to the master (meaning that this constraint should build a new block)
4040 * *block in [0,...,nblocks-1] if it only contains variables of a particular block (plus linking variables)
4042 * - either variables from more than one block (plus linking variables or master only variables)
4160 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &decomp->subscipconss[block], oldsize, newsize) ); /*lint !e866 */
4164 SCIP_CALL( SCIPhashmapSetImage(decomp->constoblock, linkcons, (void*) (size_t)((size_t)block+1)) );
4212 SCIPfreeBlockMemoryArrayNull(scip, &decomp->linkingconss, SCIPcalcMemGrowSize(scip, linkingconssize));
4249 SCIPdebugMessage("Cons <%s> in new pricing problem\n", SCIPconsGetName(decomp->linkingconss[c]));
4267 SCIP_CALL( DECfilloutDecompFromConstoblock(scip, *newdecomp, constoblock, decomp->nblocks+1, FALSE) );
4275 /** polish the decomposition and try to greedily assign master constraints to pricing problem where useful */
4302 SCIP_CALL( DECtryAssignMasterconssToNewPricing(scip, *newdecomp, &tempdecomp, &transferrednew) );
4354 SCIPrandomPermuteArray(randnumgen, (void**)linkingconss, 0, DECdecompGetNLinkingconss(decomp));
void DECdecompSetNBlocks(DEC_DECOMP *decomp, int nblocks)
Definition: decomp.c:733
structure information for decomposition information in GCG projects
SCIP_HASHMAP * DECdecompGetConsindex(DEC_DECOMP *decomp)
Definition: decomp.c:1262
SCIP_RETCODE DECdecompSetSubscipconss(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS ***subscipconss, int *nsubscipconss)
Definition: decomp.c:843
GCG interface methods.
SCIP_RETCODE DECevaluateDecomposition(SCIP *scip, DEC_DECOMP *decdecomp, DEC_SCORES *score)
Definition: decomp.c:3288
void DECdecompSetDetectorPctVarsFromOpen(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsFromOpen)
Definition: decomp.c:1871
SCIP_RETCODE GCGprintDecompStatistics(SCIP *scip, FILE *file, DEC_DECOMP *decomp)
Definition: decomp.c:3778
SCIP_Real * DECdecompGetDetectorPctVarsFromOpen(DEC_DECOMP *decomp)
Definition: decomp.c:1899
Definition: struct_decomp.h:51
static SCIP_RETCODE computeNonzeros(SCIP *scip, DEC_DECOMP *decomp, int *mnzeros, int *mintnzeros, int *lnzeros, int *lintnzeros, int *nonzeros, int *intnzeros)
Definition: decomp.c:3736
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:2670
SCIP_RETCODE DECdecompSetDetectorChain(SCIP *scip, DEC_DECOMP *decomp, DEC_DETECTOR **detectors, int ndetectors)
Definition: decomp.c:1610
SCIP_RETCODE DECcreateDecompFromMasterconss(SCIP *scip, DEC_DECOMP **decomp, SCIP_CONS **masterconss, int nmasterconss)
Definition: decomp.c:2715
DEC_DETECTOR ** DECdecompGetDetectorChain(DEC_DECOMP *decomp)
Definition: decomp.c:1600
SCIP_VAR *** DECdecompGetSubscipvars(DEC_DECOMP *decomp)
Definition: decomp.c:823
void DECdecompSetVartoblock(DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock)
Definition: decomp.c:1187
SCIP_RETCODE DECdecompRemoveDeletedConss(SCIP *scip, DEC_DECOMP *decdecomp)
Definition: decomp.c:2123
SCIP_RETCODE DECpermuteDecomp(SCIP *scip, DEC_DECOMP *decomp, SCIP_RANDNUMGEN *randnumgen)
Definition: decomp.c:4323
SCIP_RETCODE DECdecompSetSubscipvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR ***subscipvars, int *nsubscipvars)
Definition: decomp.c:755
constraint handler for structure detection
SCIP_RETCODE DECfilloutDecompFromHashmaps(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1271
int * DECdecompGetNSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:917
void DECdecompSetConstoblock(DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock)
Definition: decomp.c:1209
void DECsetMaxWhiteScore(SCIP *scip, DEC_DECOMP *decdecomp, SCIP_Real maxwhitescore)
Definition: decomp.c:3253
DEC_DETECTOR * DECdecompGetDetector(DEC_DECOMP *decomp)
Definition: decomp.c:1590
static SCIP_RETCODE computeConssNzeros(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS *cons, int *nzeros, int *nintzeros, int *nbzeros, int *nintbzeros)
Definition: decomp.c:3667
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition: scip_misc.c:490
void DECdecompSetDetectorPctConssToBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssToBlock)
Definition: decomp.c:1834
private methods for working with decomp structures
SCIP_Real * DECdecompGetDetectorPctConssToBorder(DEC_DECOMP *decomp)
Definition: decomp.c:1791
SCIP_VAR ** DECdecompGetLinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1036
SCIP_RETCODE DECdecompTransform(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:1982
SCIP_CONS ** DECdecompGetLinkingconss(DEC_DECOMP *decomp)
Definition: decomp.c:967
various SCIP helper methods
Definition: pub_decomp.h:58
static int processBlockRepresentatives(int maxblock, int *blockrepresentative)
Definition: decomp.c:2453
void DECgetLinkingVarsData(SCIP *scip, DEC_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: decomp.c:2886
void DECdecompSetConsindex(DEC_DECOMP *decomp, SCIP_HASHMAP *consindex)
Definition: decomp.c:1251
SCIP_Bool DECdecompositionsAreEqual(SCIP *scip, DEC_DECOMP *decomp1, DEC_DECOMP *decomp2)
Definition: decomp.c:3939
char * DECdecompGetDetectorChainString(SCIP *scip, DEC_DECOMP *decomp)
Definition: decomp.c:1718
SCIP_RETCODE DECdecompSetStairlinkingvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR ***stairlinkingvars, int *nstairlinkingvars)
Definition: decomp.c:1081
static SCIP_RETCODE computeVarDensities(SCIP *scip, DEC_DECOMP *decomp, int *varprobdensity, int *varmasterdensity, SCIP_VAR **vars, int nvars, DEC_STATISTIC *blockvardensities, DEC_STATISTIC *mastervardensity, int nblocks)
Definition: decomp.c:3512
Definition: decomp.c:52
SCIP_RETCODE DECdecompSetLinkingconss(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS **linkingconss, int nlinkingconss)
Definition: decomp.c:926
SCIP_HASHMAP * DECdecompGetVartoblock(DEC_DECOMP *decomp)
Definition: decomp.c:1199
int DECdecompGetDetectorChainSize(DEC_DECOMP *decomp)
Definition: decomp.c:1637
Definition: struct_detector.h:46
static SCIP_RETCODE removeFromLinkingvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR *var, SCIP_Bool *success)
Definition: decomp.c:355
SCIP_RETCODE DECdecompSetLinkingvars(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **linkingvars, int nlinkingvars, int nfixedlinkingvars, int nmastervars)
Definition: decomp.c:989
void DECdecompSetDetectorClockTimes(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *detectorClockTimes)
Definition: decomp.c:1671
SCIP_RETCODE DECcreateBasicDecomp(SCIP *scip, DEC_DECOMP **decomp, SCIP_Bool solveorigprob)
Definition: decomp.c:2388
static SCIP_RETCODE fillOutVarsFromVartoblock(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock, int nblocks, SCIP_VAR **vars, int nvars, SCIP_Bool *haslinking)
Definition: decomp.c:123
SCIP_Real * DECdecompGetDetectorPctVarsToBorder(DEC_DECOMP *decomp)
Definition: decomp.c:1756
SCIP_RETCODE DECfilloutDecompFromConstoblock(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1455
int GCGgetNIdenticalBlocks(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4053
SCIP_VAR *** DECdecompGetStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1151
void DECdecompSetPresolved(DEC_DECOMP *decomp, SCIP_Bool presolved)
Definition: decomp.c:712
static void increaseLock(SCIP *scip, SCIP_Real lhs, SCIP_Real coef, SCIP_Real rhs, int *downlock, int *uplock)
Definition: decomp.c:3079
SCIP_RETCODE DECcreatePolishedDecomp(SCIP *scip, DEC_DECOMP *decomp, DEC_DECOMP **newdecomp)
Definition: decomp.c:4276
void DECdecompSetNNewBlocks(SCIP *scip, DEC_DECOMP *decomp, int *nNewBlocks)
Definition: decomp.c:1944
int GCGconshdlrDecompIncreaseNCallsCreateDecomp(SCIP *scip)
counts up the counter for created decompositions and returns it
Definition: cons_decomp.cpp:5634
SCIP_RETCODE DECdetermineConsBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS *cons, int *block)
Definition: decomp.c:4047
static SCIP_RETCODE assignConstraintsToRepresentatives(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *consismaster, SCIP_HASHMAP *constoblock, int *vartoblock, int *nextblock, int *blockrepresentative)
Definition: decomp.c:2488
SCIP_RETCODE DECgetDensityData(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, int *varsubproblemdensity, int *varmasterdensity, int *conssubproblemdensity, int *consmasterdensity)
Definition: decomp.c:2936
SCIP_RETCODE DECtryAssignMasterconssToNewPricing(SCIP *scip, DEC_DECOMP *decomp, DEC_DECOMP **newdecomp, int *transferred)
Definition: decomp.c:4220
SCIP_Real DECdecompGetMaxwhiteScore(DEC_DECOMP *decomp)
Definition: decomp.c:701
SCIP_Real * DECdecompGetDetectorPctVarsToBlock(DEC_DECOMP *decomp)
Definition: decomp.c:1826
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition: scip_misc.c:621
int DECdecompGetNFixedLinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1057
void DECdecompSetDetectorPctConssFromOpen(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssFromOpen)
Definition: decomp.c:1907
void DECgetSubproblemVarsData(SCIP *scip, DEC_DECOMP *decomp, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars, int nproblems)
Definition: decomp.c:2837
SCIP_CONS *** DECdecompGetSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:908
int DECfilterSimilarDecompositions(SCIP *scip, DEC_DECOMP **decs, int ndecs)
Definition: decomp.c:4004
void DECdecompSetDetectorPctVarsToBorder(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsToBorder)
Definition: decomp.c:1728
void DECdecompSetPartialdecID(DEC_DECOMP *decomp, int id)
Definition: decomp.c:1648
SCIP_HASHMAP * DECdecompGetVarindex(DEC_DECOMP *decomp)
Definition: decomp.c:1242
SCIP_RETCODE DECgetVarLockData(SCIP *scip, DEC_DECOMP *decomp, SCIP_VAR **vars, int nvars, int nsubproblems, int **subsciplocksdown, int **subsciplocksup, int *masterlocksdown, int *masterlocksup)
Definition: decomp.c:3117
GCG relaxator.
SCIP_RETCODE DECdecompAddRemainingConss(SCIP *scip, DEC_DECOMP *decdecomp)
Definition: decomp.c:2179
static SCIP_Real quick_select_median(SCIP_Real arr[], int n)
Definition: decomp.c:62
void DECdecompSetDetectorPctConssToBorder(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctConssToBorder)
Definition: decomp.c:1764
static SCIP_RETCODE fillOutConsFromConstoblock(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_CONS **conss, int nconss, SCIP_Bool *haslinking)
Definition: decomp.c:242
void DECdecompSetDetector(DEC_DECOMP *decomp, DEC_DETECTOR *detector)
Definition: decomp.c:1579
int DECdecompGetNTotalStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1170
void DECdecompSetDetectorPctVarsToBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_Real *pctVarsToBlock)
Definition: decomp.c:1799
SCIP_RETCODE DECdecompSetDetectorChainString(SCIP *scip, DEC_DECOMP *decomp, const char *detectorchainstring)
Definition: decomp.c:1705
SCIP_RETCODE DECdecompCreate(SCIP *scip, DEC_DECOMP **decdecomp)
Definition: decomp.c:471
static void incVarsData(SCIP_VAR *var, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars, int nproblems, int i)
Definition: decomp.c:2798
SCIP_Real * DECdecompGetDetectorClockTimes(DEC_DECOMP *decomp)
Definition: decomp.c:1696
int GCGconshdlrDecompDecreaseNCallsCreateDecomp(SCIP *scip)
decreases the counter for created decompositions and returns it
Definition: cons_decomp.cpp:5063
int * DECdecompGetNStairlinkingvars(DEC_DECOMP *decomp)
Definition: decomp.c:1160
SCIP_RETCODE DECtryAssignMasterconssToExistingPricing(SCIP *scip, DEC_DECOMP *decomp, int *transferred)
Definition: decomp.c:4172
SCIP_Real DECgetMaxWhiteScore(SCIP *scip, DEC_DECOMP *decdecomp)
Definition: decomp.c:3270
SCIP_Bool GCGisPricingprobRelevant(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:4000
SCIP_RETCODE DECdecompCheckConsistency(SCIP *scip, DEC_DECOMP *decdecomp)
Definition: decomp.c:2267
SCIP_RETCODE DECdecompMoveLinkingConsToPricing(SCIP *scip, DEC_DECOMP *decomp, int consindex, int block)
Definition: decomp.c:4137
void DECdecompSetVarindex(DEC_DECOMP *decomp, SCIP_HASHMAP *varindex)
Definition: decomp.c:1231
SCIP_Real * DECdecompGetDetectorPctConssToBlock(DEC_DECOMP *decomp)
Definition: decomp.c:1862
SCIP_RETCODE DECdecompSetType(DEC_DECOMP *decomp, DEC_DECTYPE type)
Definition: decomp.c:647
SCIP_Real * DECdecompGetDetectorPctConssFromOpen(DEC_DECOMP *decomp)
Definition: decomp.c:1936
static SCIP_RETCODE assignConsvarsToBlock(SCIP *scip, DEC_DECOMP *decomp, SCIP_CONS *cons, int block)
Definition: decomp.c:410
SCIP_HASHMAP * DECdecompGetConstoblock(DEC_DECOMP *decomp)
Definition: decomp.c:1221