assert(labels !=
NULL);
70assert(pos < nlabels);
72currlabel = labels[pos];
78 while( endpos < nlabels && labels[endpos] == currlabel );
104 return2 *
MAX(norigvars, ntransvars);
120assert(decomp !=
NULL);
154assert(decomp !=
NULL);
155assert(cons !=
NULL);
156assert(varbuf !=
NULL);
157assert(nvars !=
NULL);
158assert(requiredsize !=
NULL);
159assert(success !=
NULL);
172 if( bufsize < *nvars )
174*requiredsize = *nvars;
190 if( *requiredsize > bufsize )
196 for( v = 0; v < *nvars; ++v )
207 if( labelbuf !=
NULL)
251assert(decomp !=
NULL);
272 SCIP_CALL_ABORT(
SCIPcheckStage(
scip,
"SCIPgetDecomps",
FALSE, original, original,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE) );
274 if( decomps !=
NULL)
277 if( ndecomps !=
NULL)
295assert(cons !=
NULL);
296assert(decomp !=
NULL);
297assert(hasonlylinkvars !=
NULL);
311assert(requiredsize <= nvars);
314*hasonlylinkvars =
TRUE;
316 for( i = 0; i < nvars && *hasonlylinkvars; ++i )
360assert(decomp !=
NULL);
372benderserror =
FALSE;
375 for( c = 0; c < nconss && ! benderserror; ++c )
379 intnlinkingvars = 0;
386varbufsize, &nconsvars, &requiredsize, &success) );
391 for( v = 0; v < nconsvars; ++v )
393 intvarlabel = varlabels[v];
399conslabel = varlabel;
400 else if( conslabel != varlabel )
406benderserror =
TRUE;
420conslabels[c] = conslabel;
432 SCIPerrorMessage(
"Error in constraint label computation; variables from multiple named blocks in a single constraint\n");
469assert(decomp !=
NULL);
470assert(conss !=
NULL);
484 for( c = 0; c < nconss; ++c )
493conslabel = conslabels[c];
498 if( ! benderslabels )
504newvarlabel = conslabel;
507varbufsize, &nconsvars, &requiredsize, &success) );
511 for( v = 0; v < nconsvars; ++v )
570assert(decomp !=
NULL);
581 for( c = 0; c < nvars; c++ )
585defaultlabel = varslabels[c];
591 for( c = 0; c < nconss; c++ )
596&nconsvars, &requiredsize, &success) );
601 if( nconsvars == 0 )
633assert(nlinkvars < nconsvars);
642 if( nblockvars > maxnblockvars )
644maxnblockvars = nblockvars;
649 while( curr < nconsvars );
652startposs[0] = nlinkvars;
654startposs[1] = block + maxnblockvars;
655endposs[1] = nconsvars;
658 for( p = 0; p < 2; ++p )
661 for( v = startposs[p]; v < endposs[p]; ++v )
672 if( nskipconss !=
NULL)
673*nskipconss = nskipconsslocal;
732 for( c = 0; c < nconss; ++c )
735 intconslabel = conslabels[c];
749varbufsize, &nconsvars, &requiredsize, &success) );
756 while( varblockstart < nconsvars )
761varblockpos =
findLabelIdx(decomp, varslabels[varblockstart]);
767 if( varblockpos == blockpos )
768withinedges[varblockpos] += nblockvars;
773totaldegrees[blockpos] += nblockvars;
774totaldegrees[varblockpos] += nblockvars;
775nnonzeroes += nblockvars;
778varblockstart += nblockvars;
785 inttotaldegreesum = 0;
787totaldegreesum += totaldegrees[
b];
789assert(totaldegreesum == 2 * nnonzeroes);
795nnonzeroes =
MAX(nnonzeroes, 1);
799expectedval = totaldegrees[
b] / (2.0 * nnonzeroes);
800expectedval =
SQR(expectedval);
801*modularity += (withinedges[
b] / (
SCIP_Real)nnonzeroes) - expectedval;
826 if( nvars > 0 && nconss > 0 )
829 intnlinkvars = decomp->
varssize[0];
835 for( i = 1; i < decomp->
nblocks+ 1; ++i )
870 intnlinkingvars = 0;
875 intnblockgraphedges;
882 if( maxgraphedge == -1 )
883maxgraphedge = INT_MAX;
886assert(decomp !=
NULL);
916 for( v = 0; v < nvars; ++v )
920linkvaridx[v] = nlinkingvars;
942 while( conspos < nconss )
947 intnblocklinkingvars = 0;
956 for( c = conspos; c < conspos + nblockconss && nblocklinkingvars < nlinkingvars; ++c )
963varbufsize, &nconsvars, &requiredsize, &success) );
967 for( j = 0; j < nconsvars && nblocklinkingvars < nlinkingvars; ++j )
969 intlinkingvarnodeidx;
975assert(linkingvarnodeidx >= 0);
977 if( !adjacent[linkingvarnodeidx] )
979adjacent[linkingvarnodeidx] =
TRUE;
980adjacentidxs[nblocklinkingvars++] = linkingvarnodeidx;
986assert(blocknodeidx ==
findLabelIdx(decomp, conslabels[conspos]) - 1);
987 for( i = 0; i < nblocklinkingvars; ++i )
994 for( i = 0; i < nblocklinkingvars; ++i )
995adjacent[adjacentidxs[i]] =
FALSE;
999 for( i = 0; i < nlinkingvars; ++i )
1000assert(adjacent[i] ==
FALSE);
1006conspos += nblockconss;
1018 if( nsuccvar == nblocks )
1020decomp->
nedges= nblocks * (nblocks - 1) / 2;
1034nblockgraphedges = 0;
1035 for( n = 0; n < nblocks - 1 && nblockgraphedges < maxgraphedge; ++n )
1040 intnadjacentblks = 0;
1049 for( i = 0; i < nsuccblk && nadjacentblks < nblocks - (n + 1); ++i )
1062 for( j = startpos + 1; j < nsuccvar; ++j )
1064assert( succnodesvar[j] > n );
1065 if( !adjacent[succnodesvar[j]] )
1067adjacent[succnodesvar[j]] =
TRUE;
1068adjacentidxs[nadjacentblks] = succnodesvar[j];
1075 for( i = 0; i < nadjacentblks && nblockgraphedges < maxgraphedge; ++i )
1084 for( i = 0; i < nadjacentblks; ++i )
1085adjacent[adjacentidxs[i]] =
FALSE;
1094decomp->
nedges= nblockgraphedges;
1104 if( nsuccblk < tempmin )
1106 else if( nsuccblk > tempmax )
1127 if( blockgraph !=
NULL)
1160assert(decomp !=
NULL);
1168 if( nvars == 0 || nconss == 0 )
1215 while( varidx < nvars || considx < nconss )
1220varlabel = varidx < nvars ? varslabels[varidx] : INT_MAX;
1221conslabel = considx < nconss ? conslabels[considx] : INT_MAX;
1223assert(currlabelidx < decomp->memsize);
1225decomp->
labels[currlabelidx] =
MIN(varlabel, conslabel);
1228 if( varlabel <= conslabel )
1231decomp->
varssize[currlabelidx] = 0;
1234 if( conslabel <= varlabel )
1240varidx += decomp->
varssize[currlabelidx];
1241considx += decomp->
consssize[currlabelidx];
1249 if( currlabelidx < decomp->nblocks + 1 )
1250decomp->
nblocks= currlabelidx - 1;
1253varblockstart = decomp->
varssize[0];
1254consblockstart = decomp->
consssize[0];
1256 for( i = 1; i < decomp->
nblocks+ 1; ++i )
1262 intnblockconss = decomp->
consssize[i];
1265 for( c = consblockstart; c < consblockstart + nblockconss; ++c )
1277 intnblockvars = decomp->
varssize[i];
1281 for( v = varblockstart; v < varblockstart + nblockvars; ++v )
1287decomp->
varssize[0] += nblockvars;
1290varblockstart += decomp->
varssize[i];
1291consblockstart += decomp->
consssize[i];
1297 for( i = 1; i < decomp->
nblocks+ 1; ++i )
1310decomp->
nblocks= currlabelidx - 1;
1314 for( i = 1; i < decomp->
nblocks+ 1; ++i )
1326 if( !disablemeasures )
1340 if( maxgraphedge != 0 )
int SCIPdecompstoreGetNOrigDecomps(SCIP_DECOMPSTORE *decompstore)
SCIP_DECOMP ** SCIPdecompstoreGetDecomps(SCIP_DECOMPSTORE *decompstore)
SCIP_DECOMP ** SCIPdecompstoreGetOrigDecomps(SCIP_DECOMPSTORE *decompstore)
SCIP_RETCODE SCIPdecompstoreAdd(SCIP_DECOMPSTORE *decompstore, SCIP_DECOMP *decomp)
int SCIPdecompstoreGetNDecomps(SCIP_DECOMPSTORE *decompstore)
internal methods for decompositions and the decomposition store
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
#define SCIP_CALL_ABORT(x)
SCIP_RETCODE SCIPcomputeDecompConsLabels(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS **conss, int nconss)
void SCIPgetDecomps(SCIP *scip, SCIP_DECOMP ***decomps, int *ndecomps, SCIP_Bool original)
SCIP_RETCODE SCIPdecompSetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
int SCIPdecompGetNBlocks(SCIP_DECOMP *decomp)
SCIP_RETCODE SCIPcomputeDecompVarsLabels(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS **conss, int nconss)
SCIP_RETCODE SCIPdecompSetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
SCIP_RETCODE SCIPassignDecompLinkConss(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS **conss, int nconss, int *nskipconss)
SCIP_RETCODE SCIPdecompCreate(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem, int nblocks, SCIP_Bool original, SCIP_Bool benderslabels)
void SCIPfreeDecomp(SCIP *scip, SCIP_DECOMP **decomp)
SCIP_RETCODE SCIPcomputeDecompStats(SCIP *scip, SCIP_DECOMP *decomp, SCIP_Bool uselimits)
SCIP_RETCODE SCIPaddDecomp(SCIP *scip, SCIP_DECOMP *decomp)
SCIP_RETCODE SCIPhasConsOnlyLinkVars(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS *cons, SCIP_Bool *hasonlylinkvars)
void SCIPdecompGetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
SCIP_RETCODE SCIPcreateDecomp(SCIP *scip, SCIP_DECOMP **decomp, int nblocks, SCIP_Bool original, SCIP_Bool benderslabels)
void SCIPdecompFree(SCIP_DECOMP **decomp, BMS_BLKMEM *blkmem)
void SCIPdecompGetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
SCIP_Bool SCIPdecompUseBendersLabels(SCIP_DECOMP *decomp)
SCIP_Bool SCIPdecompIsOriginal(SCIP_DECOMP *decomp)
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
SCIP_RETCODE SCIPdigraphGetArticulationPoints(SCIP_DIGRAPH *digraph, int **articulations, int *narticulations)
SCIP_RETCODE SCIPcreateDigraph(SCIP *scip, SCIP_DIGRAPH **digraph, int nnodes)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
#define SCIPfreeCleanBufferArray(scip, ptr)
#define SCIPallocCleanBufferArray(scip, ptr, num)
#define SCIPallocClearBufferArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
SCIP_RETCODE SCIPgetActiveVars(SCIP *scip, SCIP_VAR **vars, int *nvars, int varssize, int *requiredsize)
SCIP_Bool SCIPsortedvecFindInt(int *intarray, int val, int len, int *pos)
void SCIPsortIntPtr(int *intarray, void **ptrarray, int len)
void SCIPsortInt(int *intarray, int len)
methods for block memory pools and memory buffers
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
public methods for managing constraints
public methods for decompositions
public methods for message output
public data structures and miscellaneous methods
public methods for problem variables
public methods for constraint handler plugins and constraints
public methods for data structures
static SCIP_RETCODE computeModularity(SCIP *scip, SCIP_DECOMP *decomp, SCIP_Real *modularity)
static SCIP_RETCODE ensureCondition(SCIP_Bool condition)
static void getDecompVarsConssData(SCIP *scip, SCIP_DECOMP *decomp, SCIP_VAR ***vars, SCIP_CONS ***conss, int *nvars, int *nconss)
static int findLabelIdx(SCIP_DECOMP *decomp, int label)
static void computeAreaScore(SCIP *scip, SCIP_DECOMP *decomp)
static int getVarbufSize(SCIP *scip)
static SCIP_RETCODE buildBlockGraph(SCIP *scip, SCIP_DECOMP *decomp, int maxgraphedge)
static SCIP_RETCODE decompGetConsVarsAndLabels(SCIP *scip, SCIP_DECOMP *decomp, SCIP_CONS *cons, SCIP_VAR **varbuf, int *labelbuf, int bufsize, int *nvars, int *requiredsize, SCIP_Bool *success)
static int countLabelFromPos(int *labels, int pos, int nlabels)
public methods for decompositions
public methods for memory management
public methods for message handling
public methods for SCIP parameter handling
public methods for global and local (sub)problems
public methods for SCIP variables
data structures for a decomposition and a decomposition store
SCIP main data structure.
#define SCIP_DECOMP_LINKVAR
#define SCIP_DECOMP_LINKCONS
enum SCIP_Retcode SCIP_RETCODE
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4