96 assert(bounds != NULL);
97 assert(boundtypes != NULL);
98 assert(newbounds != NULL);
99 assert(counts != NULL);
100 assert(issetvar != NULL);
101 assert(2 * nvars > varidx);
102 assert(foundbin != NULL);
103 assert(foundnonbin != NULL);
104 assert(implidx != NULL);
105 assert(nimplidx != NULL);
106 assert(lastbounds != NULL);
109 if( !boundtypes[pos] )
111 assert(counts[varidx] <= pos - nredvars + 1);
114 if( counts[varidx] == pos - nredvars )
118 if( counts[varidx] == 1 )
120 assert(*ncountnonzeros < 2*nvars);
121 countnonzeros[*ncountnonzeros] = varidx;
123 newbounds[varidx] = bounds[pos];
126 else if( newbounds[varidx] > bounds[pos] )
128 lastbounds[*nimplidx] = newbounds[varidx];
129 newbounds[varidx] = bounds[pos];
136 *foundnonbin = MIN(*foundnonbin, varidx);
138 implidx[*nimplidx] = varidx;
147 for( w = nimpls - 1; w >= 0; --w )
158 if( implcoefs[w] < 0.0 )
163 if( counts[idx] == pos - nredvars )
174 if(
SCIPisFeasLT(scip, implcoefs[w] + implconsts[w], bounds[pos]) )
179 if( issetvar[idx] > 0 )
181 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g\n",
184 issetvar[varidx] = -1;
189 *foundbin = MIN(*foundbin, idx);
191 if( counts[idx] == 1 )
193 assert(*ncountnonzeros < 2*nvars);
194 countnonzeros[*ncountnonzeros] = idx;
198 implidx[*nimplidx] = idx;
211 newub = (bounds[pos] - implconsts[w]) / implcoefs[w];
216 if( issetvar[idx] > 0 && newub <= bounds[issetvar[idx] - 1] )
218 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
221 issetvar[varidx] = -1;
227 if( counts[idx] == 1 )
229 assert(*ncountnonzeros < 2*nvars);
230 countnonzeros[*ncountnonzeros] = idx;
232 newbounds[idx] = newub;
235 else if( newbounds[idx] < newub )
237 lastbounds[*nimplidx] = newbounds[idx];
238 newbounds[idx] = newub;
243 *foundnonbin = MIN(*foundnonbin, idx);
245 implidx[*nimplidx] = idx;
252 assert(counts[varidx] <= pos - nredvars + 1);
255 if( counts[idx] == pos - nredvars )
271 if( issetvar[idx] > 0 )
273 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g\n",
276 issetvar[varidx] = -1;
281 *foundbin = MIN(*foundbin, idx);
283 if( counts[idx] == 1 )
285 assert(*ncountnonzeros < 2*nvars);
286 countnonzeros[*ncountnonzeros] = idx;
290 implidx[*nimplidx] = idx;
303 newlb = (bounds[pos] - implconsts[w]) / implcoefs[w];
308 if( issetvar[idx] > 0 && newlb >= bounds[issetvar[idx] - 1] )
310 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
313 issetvar[varidx] = -1;
319 if( counts[idx] == 1 )
321 assert(*ncountnonzeros < 2*nvars);
322 countnonzeros[*ncountnonzeros] = idx;
325 newbounds[idx] = newlb;
327 else if( newbounds[idx] > newlb )
329 lastbounds[*nimplidx] = newbounds[idx];
330 newbounds[idx] = newlb;
336 *foundnonbin = MIN(*foundnonbin, idx);
338 implidx[*nimplidx] = idx;
348 assert(boundtypes[pos]);
349 assert(counts[varidx] <= pos - nredvars + 1);
352 if( counts[varidx] == pos - nredvars )
356 if( counts[varidx] == 1 )
358 assert(*ncountnonzeros < 2*nvars);
359 countnonzeros[*ncountnonzeros] = varidx;
361 newbounds[varidx] = bounds[pos];
364 else if( newbounds[varidx] < bounds[pos] )
366 lastbounds[*nimplidx] = newbounds[varidx];
367 newbounds[varidx] = bounds[pos];
374 *foundnonbin = MIN(*foundnonbin, varidx);
376 implidx[*nimplidx] = varidx;
385 for( w = nimpls - 1; w >= 0; --w )
396 if( implcoefs[w] < 0.0 )
398 assert(counts[idx] <= pos - nredvars + 1);
401 if( counts[idx] == pos - nredvars )
414 if( issetvar[idx] > 0 )
416 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g\n",
419 issetvar[varidx] = -1;
424 *foundbin = MIN(*foundbin, idx);
426 if( counts[idx] == 1 )
428 assert(*ncountnonzeros < 2*nvars);
429 countnonzeros[*ncountnonzeros] = idx;
433 implidx[*nimplidx] = idx;
446 newlb = (bounds[pos] - implconsts[w]) / implcoefs[w];
448 if( issetvar[idx] > 0 && newlb >= bounds[issetvar[idx] - 1] )
450 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
453 issetvar[varidx] = -1;
459 if( counts[idx] == 1 )
461 assert(*ncountnonzeros < 2*nvars);
462 countnonzeros[*ncountnonzeros] = idx;
465 newbounds[idx] = newlb;
467 else if( newbounds[idx] > newlb )
469 lastbounds[*nimplidx] = newbounds[idx];
470 newbounds[idx] = newlb;
475 *foundnonbin = MIN(*foundnonbin, idx);
477 implidx[*nimplidx] = idx;
487 assert(counts[idx] <= pos - nredvars + 1);
489 if( counts[idx] == pos - nredvars )
500 if(
SCIPisFeasGT(scip, implcoefs[w] + implconsts[w], bounds[pos]) )
502 if( issetvar[idx] > 0 )
504 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g\n",
507 issetvar[varidx] = -1;
512 *foundbin = MIN(*foundbin, idx);
514 if( counts[idx] == 1 )
516 assert(*ncountnonzeros < 2*nvars);
517 countnonzeros[*ncountnonzeros] = idx;
521 implidx[*nimplidx] = idx;
534 newub = (bounds[pos] - implconsts[w]) / implcoefs[w];
536 if( issetvar[idx] > 0 && newub <= bounds[issetvar[idx] - 1] )
538 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
541 issetvar[varidx] = -1;
547 if( counts[idx] == 1 )
549 assert(*ncountnonzeros < 2*nvars);
550 countnonzeros[*ncountnonzeros] = idx;
553 newbounds[idx] = newub;
555 else if( newbounds[idx] < newub )
557 lastbounds[*nimplidx] = newbounds[idx];
558 newbounds[idx] = newub;
563 *foundnonbin = MIN(*foundnonbin, idx);
565 implidx[*nimplidx] = idx;
624 assert(scip != NULL);
629 assert(bounds != NULL);
630 assert(boundtypes != NULL);
631 assert(newbounds != NULL);
632 assert(counts != NULL);
633 assert(issetvar != NULL);
634 assert(2 * nvars > varidx);
635 assert(foundbin != NULL);
636 assert(foundnonbin != NULL);
637 assert(implidx != NULL);
638 assert(nimplidx != NULL);
639 assert(lastbounds != NULL);
641 if( issetvar[varidx] > 0 )
656 assert(implvars != NULL);
657 assert(implboundtypes != NULL);
660 assert(implvars[w] != var);
673 assert(counts[idx] <= pos - nredvars + 1);
678 if( issetvar[idx] > 0 && bounds[issetvar[idx] - 1] >= implbounds[w] )
680 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
682 "<=", implbounds[w], bounds[issetvar[idx] - 1]);
684 issetvar[varidx] = -1;
689 if( counts[idx] == pos - nredvars )
702 *foundbin = MIN(*foundbin, idx);
704 if( counts[idx] == 1 )
706 assert(*ncountnonzeros < 2*nvars);
707 countnonzeros[*ncountnonzeros] = idx;
713 *foundnonbin = MIN(*foundnonbin, idx);
715 if( counts[idx] == 1 )
717 assert(*ncountnonzeros < 2*nvars);
718 countnonzeros[*ncountnonzeros] = idx;
720 newbounds[idx] = implbounds[w];
723 else if( newbounds[idx] < implbounds[w] )
725 lastbounds[*nimplidx] = newbounds[idx];
726 newbounds[idx] = implbounds[w];
732 implidx[*nimplidx] = idx;
738 assert(counts[idx] <= pos - nredvars + 1);
743 if( issetvar[idx] > 0 && bounds[issetvar[idx] - 1] <= implbounds[w] )
745 SCIPdebugMsg(scip,
"set variable <%s> %s %g implies other set variable <%s> %s %g (%g)\n",
747 ">=", implbounds[w], bounds[issetvar[idx] - 1]);
749 issetvar[varidx] = -1;
754 if( counts[idx] == pos - nredvars )
767 *foundbin = MIN(*foundbin, idx);
769 if( counts[idx] == 1 )
771 assert(*ncountnonzeros < 2*nvars);
772 countnonzeros[*ncountnonzeros] = idx;
778 *foundnonbin = MIN(*foundnonbin, idx);
780 if( counts[idx] == 1 )
782 assert(*ncountnonzeros < 2*nvars);
783 countnonzeros[*ncountnonzeros] = idx;
785 newbounds[idx] = implbounds[w];
788 else if( newbounds[idx] > implbounds[w] )
790 lastbounds[*nimplidx] = newbounds[idx];
791 newbounds[idx] = implbounds[w];
797 implidx[*nimplidx] = idx;
851 assert(bounds != NULL);
852 assert(boundtypes != NULL);
853 assert(newbounds != NULL);
854 assert(counts != NULL);
855 assert(issetvar != NULL);
856 assert(2 * nvars > varidx);
857 assert(foundbin != NULL);
858 assert(implidx != NULL);
859 assert(nimplidx != NULL);
862 assert(counts[varidx] <= pos - nredvars);
865 if( issetvar[varidx] > 0 )
868 if( counts[varidx] == pos - nredvars )
871 *foundbin = MIN(*foundbin, varidx);
873 if( counts[varidx] == 1 )
875 assert(*ncountnonzeros < 2*nvars);
876 countnonzeros[*ncountnonzeros] = varidx;
880 implidx[*nimplidx] = varidx;
905 assert(counts[idx] <= pos - nredvars + 1);
910 if( issetvar[idx] > 0 )
912 SCIPdebugMessage(
"set variable <%s> %s %g implies other set variable <%s> %s %g\n",
914 clqvalues[w] ?
"<=" :
">=", clqvalues[w] ? 0.0 : 1.0);
916 issetvar[varidx] = -1;
921 if( counts[idx] == pos - nredvars )
924 *foundbin = MIN(*foundbin, idx);
926 if( counts[idx] == 1 )
928 assert(*ncountnonzeros < 2*nvars);
929 countnonzeros[*ncountnonzeros] = idx;
933 implidx[*nimplidx] = idx;
946 #define CLEARRATIO 0.8 1018 int start = INT_MAX;
1025 int maxcountnonzeros;
1032 assert(scip != NULL);
1033 assert(vars != NULL);
1034 assert(bounds != NULL);
1035 assert(boundtypes != NULL);
1036 assert(redundants != NULL);
1037 assert(nredvars != NULL);
1038 assert(nglobalred != NULL);
1039 assert(setredundant != NULL);
1040 assert(glbinfeas != NULL);
1056 maxcountnonzeros = (int)(2*nprobvars*
CLEARRATIO);
1059 for( v = 0; v < nvars; ++v )
1062 assert(varidx >= 0);
1065 varidx += nprobvars;
1068 issetvar[varidx] = v+1;
1087 for( v = 0; v < nvars; ++v )
1092 foundnonbin = INT_MAX;
1096 value = (!boundtypes[v]);
1099 assert(varidx >= 0);
1102 varidx += nprobvars;
1109 collectBinaryCliqueData(var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts, countnonzeros,
1110 &ncountnonzeros, issetvar, nprobvars, &foundbin, implidx, &nimplidx);
1122 collectNonBinaryImplicationData(scip, var, varidx, v, *nredvars, value, bounds, boundtypes, newbounds, counts,
1123 countnonzeros, &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds);
1132 collectNonBinaryVBoundData(scip, var, varidx, v, *nredvars, bounds, boundtypes, newbounds, counts, countnonzeros,
1133 &ncountnonzeros, issetvar, nprobvars, &foundbin, &foundnonbin, implidx, &nimplidx, lastbounds);
1137 if( issetvar[varidx] < 0 )
1144 assert(probvars != NULL);
1149 for( w = nimplidx - 1; w >= 0; --w )
1151 assert(implidx[w] < 2 * nprobvars);
1152 assert(counts[implidx[w]] == v - (*nredvars) + 1);
1154 --counts[implidx[w]];
1156 if( implidx[w] == countnonzeros[ncountnonzeros-1] && counts[implidx[w]] == 0 )
1160 if( implidx[w] < nprobvars )
1163 newbounds[implidx[w]] = lastbounds[w];
1168 newbounds[implidx[w] - nprobvars] = lastbounds[w];
1179 if( !fullshortening )
1182 if( foundbin < INT_MAX && !reducedset )
1185 if( foundnonbin < INT_MAX && !reducedset )
1190 globalred = globalred && (foundbin < INT_MAX || foundnonbin < INT_MAX);
1196 if( foundbin < INT_MAX && foundbin >= nprobvars )
1197 foundbin -= nprobvars;
1200 if( foundnonbin < INT_MAX && foundnonbin >= nprobvars )
1201 foundnonbin -= nprobvars;
1203 if( start > foundbin )
1206 if( start > foundnonbin )
1207 start = foundnonbin;
1213 if( !usebin && !usenonbin )
1224 for( v = nvars - 1; v >= 0; --v )
1229 assert(varidx >= 0);
1232 varidx += nprobvars;
1235 if( issetvar[varidx] < 0 )
1239 redundants[v] =
TRUE;
1245 assert((*nredvars) == nreds);
1257 assert(probvars != NULL);
1259 assert(start < nprobvars);
1262 for( v = start; v < nprobvars; ++v )
1264 probvar = probvars[v];
1265 assert(probvar != NULL);
1267 assert(counts[v] <= nvars);
1268 assert(counts[nprobvars + v] <= nvars);
1270 if( counts[v] + (*nredvars) == nvars )
1287 if( issetvar[v] > 0 )
1288 *setredundant =
TRUE;
1299 SCIPdebugMsg(scip,
"-> global infeasibility proven.\n");
1314 if( issetvar[v] > 0 && newbounds[v] >= bounds[issetvar[v] - 1] )
1315 *setredundant =
TRUE;
1319 else if( counts[nprobvars + v] + (*nredvars) == nvars )
1336 if( issetvar[nprobvars + v] > 0 )
1337 *setredundant =
TRUE;
1342 int idx = nprobvars + v;
1350 SCIPdebugMsg(scip,
"-> global infeasibility proven.\n");
1365 if( issetvar[idx] > 0 && newbounds[idx] <= bounds[issetvar[idx] - 1] )
1366 *setredundant =
TRUE;
1374 for( v = 0; v < nvars; ++v )
1377 assert(varidx >= 0);
1380 varidx += nprobvars;
1382 issetvar[varidx] = 0;
1385 if( ncountnonzeros >= maxcountnonzeros )
1391 while( --ncountnonzeros >= 0 )
1392 counts[countnonzeros[ncountnonzeros]] = 0;
static void collectNonBinaryVBoundData(SCIP *scip, SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *foundnonbin, int *implidx, int *nimplidx, SCIP_Real *lastbounds)
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_Real * SCIPvarGetVlbCoefs(SCIP_VAR *var)
SCIP_VAR ** SCIPcliqueGetVars(SCIP_CLIQUE *clique)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for branch and bound tree
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPvarGetNVlbs(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_EVENTQUEUE * eventqueue
SCIP_CLIQUE ** SCIPvarGetCliques(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
int SCIPprobGetNVars(SCIP_PROB *prob)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_BRANCHCAND * branchcand
SCIP_RETCODE SCIPcutoffNode(SCIP *scip, SCIP_NODE *node)
enum SCIP_Retcode SCIP_RETCODE
int SCIPvarGetNVubs(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_VAR ** SCIPvarGetVlbVars(SCIP_VAR *var)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_NODE * SCIPgetRootNode(SCIP *scip)
int SCIPvarGetNCliques(SCIP_VAR *var, SCIP_Bool varfixing)
#define SCIPallocCleanBufferArray(scip, ptr, num)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
internal methods for storing and manipulating the main problem
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
methods for block memory pools and memory buffers
SCIP_Real * SCIPvarGetVubConstants(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP main data structure.
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real * SCIPvarGetVlbConstants(SCIP_VAR *var)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real * SCIPvarGetVubCoefs(SCIP_VAR *var)
methods commonly used for presolving
SCIP_CLIQUETABLE * cliquetable
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing)
int SCIPvarGetNImpls(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_Bool * SCIPcliqueGetValues(SCIP_CLIQUE *clique)
SCIP_Real * SCIPvarGetImplBounds(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_VAR ** SCIPvarGetImplVars(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for main solving loop and node processing
SCIP_RETCODE SCIPnodeAddBoundchg(SCIP_NODE *node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var, SCIP_Real newbound, SCIP_BOUNDTYPE boundtype, SCIP_Bool probingchange)
#define SCIPfreeCleanBufferArray(scip, ptr)
SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
SCIP_VAR ** SCIPvarGetVubVars(SCIP_VAR *var)
int SCIPprobGetNImplBinVars(SCIP_PROB *prob)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_RETCODE SCIPshrinkDisjunctiveVarSet(SCIP *scip, SCIP_VAR **vars, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Bool *redundants, int nvars, int *nredvars, int *nglobalred, SCIP_Bool *setredundant, SCIP_Bool *glbinfeas, SCIP_Bool fullshortening)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
static void collectNonBinaryImplicationData(SCIP *scip, SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Bool value, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *foundnonbin, int *implidx, int *nimplidx, SCIP_Real *lastbounds)
int SCIPcliqueGetNVars(SCIP_CLIQUE *clique)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPcleanupCliques(SCIP *scip, SCIP_Bool *infeasible)
static void collectBinaryCliqueData(SCIP_VAR *var, int varidx, int pos, int nredvars, SCIP_Bool value, SCIP_Real *bounds, SCIP_Bool *boundtypes, SCIP_Real *newbounds, int *counts, int *countnonzeros, int *ncountnonzeros, int *issetvar, int nvars, int *foundbin, int *implidx, int *nimplidx)
const char * SCIPprobGetName(SCIP_PROB *prob)