lp.c
Go to the documentation of this file.
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
501 /* we do not save the farkas coefficient, since it can be recomputed; thus, we invalidate it here */
504 /* if the column was created after performing the storage (possibly during probing), we treat it as implicitly zero;
589 /* if the row was created after performing the storage (possibly during probing), we treat it as basic;
760 /* recompute the loose objective value from scratch, if it was marked to be unreliable before */
789 /* we are only interested in variables with a finite impact, because the infinity counters should be correct */
802 /* recompute the pseudo solution value from scratch, if it was marked to be unreliable before */
826 /* we are only interested in variables with a finite impact, because the infinity counters should be correct */
844 /* recompute the global pseudo solution value from scratch, if it was marked to be unreliable before */
868 /* we are only interested in variables with a finite impact, because the infinity counters should be correct */
950 /** sorts column entries of linked rows currently in the LP such that lower row indices precede higher ones */
981 /** sorts column entries of unlinked rows or rows currently not in the LP such that lower row indices precede higher
998 SCIPsortPtrRealInt((void**)(&(col->rows[col->nlprows])), &(col->vals[col->nlprows]), &(col->linkpos[col->nlprows]), SCIProwComp, col->len - col->nlprows);
1014 /** sorts row entries of linked columns currently in the LP such that lower column indices precede higher ones */
1029 SCIPsortIntPtrIntReal(row->cols_index, (void**)row->cols, row->linkpos, row->vals, row->nlpcols);
1045 /** sorts row entries of unlinked columns or columns currently not in the LP such that lower column indices precede
1064 SCIPsortIntPtrIntReal(&(row->cols_index[row->nlpcols]), (void**)(&(row->cols[row->nlpcols])), &(row->linkpos[row->nlpcols]), &(row->vals[row->nlpcols]), row->len - row->nlpcols);
1082 /** searches coefficient in part of the column, returns position in col vector or -1 if not found */
1157 /** searches coefficient in part of the row, returns position in col vector or -1 if not found */
1249 /** moves a coefficient in a column to a different place, and updates all corresponding data structures */
1345 /** moves a coefficient in a row to a different place, and updates all corresponding data structures */
1466 if( (row->eventfilter->len > 0 && (row->eventfilter->eventmask & SCIP_EVENTTYPE_ROWCOEFCHANGED) != 0) )
1471 SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, row->eventfilter, &event) );
1494 if( (row->eventfilter->len > 0 && (row->eventfilter->eventmask & SCIP_EVENTTYPE_ROWCONSTCHANGED) != 0) )
1499 SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, row->eventfilter, &event) );
1523 if( (row->eventfilter->len > 0 && (row->eventfilter->eventmask & SCIP_EVENTTYPE_ROWSIDECHANGED) != 0) )
1528 SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, row->eventfilter, &event) );
1534 #if 0 /* enable this to check links between columns and rows in LP data structure (for debugging, very slow!) */
1700 /*assert(colSearchCoef(col, row) == -1);*/ /* this assert would lead to slight differences in the solution process */
1710 /* if the row is in current LP and is linked to the column, we have to insert it at the end of the linked LP rows
1724 /* in case the coefficient is integral w.r.t. numerics we explicitly round the coefficient to an integral value */
1735 /* if the column is in current LP, we have to link it to the row, because otherwise, the primal information
1740 /* this call might swap the current row with the first non-LP/not linked row, s.t. insertion position
1762 /* if the column is in current LP, now both conditions, row->cols[linkpos]->lppos >= 0 and row->linkpos[linkpos] >= 0
1794 SCIPsetDebugMsg(set, "added coefficient %g * <%s> at position %d (%d/%d) to column <%s> (nunlinked=%d)\n",
1828 /* if row is a linked LP row, move last linked LP coefficient to position of empty slot (deleted coefficient) */
1864 /* in case the coefficient is integral w.r.t. numerics we explicitly round the coefficient to an integral value */
1910 /* Euclidean norm, sum norm, and objective function scalar product only take LP columns into account */
1995 /* Euclidean norm, sum norm, and objective function scalar product only take LP columns into account */
2046 /*assert(rowSearchCoef(row, col) == -1);*/ /* this assert would lead to slight differences in the solution process */
2061 /* if the column is in current LP and is linked to the row, we have to insert it at the end of the linked LP columns
2075 /* in case the coefficient is integral w.r.t. numerics we explicitly round the coefficient to an integral value */
2088 /* if the row is in current LP, we have to link it to the column, because otherwise, the dual information
2093 /* this call might swap the current column with the first non-LP/not linked column, s.t. insertion position
2115 /* if the row is in current LP, now both conditions, col->rows[linkpos]->lppos >= 0 and col->linkpos[linkpos] >= 0
2156 SCIPsetDebugMsg(set, "added coefficient %g * <%s> at position %d (%d/%d) to row <%s> (nunlinked=%d)\n",
2194 SCIPerrorMessage("cannot delete a coefficient from the locked unmodifiable row <%s>\n", row->name);
2201 /* if column is a linked LP column, move last linked LP coefficient to position of empty slot (deleted coefficient) */
2247 SCIPerrorMessage("cannot change a coefficient of the locked unmodifiable row <%s>\n", row->name);
2251 /* in case the coefficient is integral w.r.t. numerics we explicitly round the coefficient to an integral value */
2362 /* this call might swap the current row with the first non-LP/not linked row, but this is of no harm */
2367 assert(col->nlprows == 0 || col->rows[col->nlprows-1]->cols[col->linkpos[col->nlprows-1]] == col);
2368 assert(col->nlprows == 0 || col->rows[col->nlprows-1]->linkpos[col->linkpos[col->nlprows-1]] == col->nlprows-1);
2444 /* this call might swap the current column with the first non-LP/not linked column, but this is of no harm */
2449 assert(row->nlpcols == 0 || row->cols[row->nlpcols-1]->rows[row->linkpos[row->nlpcols-1]] == row);
2450 assert(row->nlpcols == 0 || row->cols[row->nlpcols-1]->linkpos[row->linkpos[row->nlpcols-1]] == row->nlpcols-1);
2566 /** checks, that parameter of type int in LP solver has the given value, ignoring unknown parameters */
2591 /** checks, that parameter of type SCIP_Bool in LP solver has the given value, ignoring unknown parameters */
2602 /** checks, that parameter of type SCIP_Real in LP solver has the given value, ignoring unknown parameters */
2621 /* This assert is currently disabled because it can happen that the feasibility tolerance is changed to a
2622 * value outside the interval allowed by the LP solver, in which case the lpi might project it to the bounds
2624 * It should be reenabled once this behaviour is unified among the lpis and handled explicitly in
2641 #define lpCutoffDisabled(set) (set->lp_disablecutoff == 1 || (set->nactivepricers > 0 && set->lp_disablecutoff == 2))
2657 /* We disabled the objective limit in the LP solver or we want so solve exactly and thus cannot rely on the LP
2658 * solver's objective limit handling, so we return here and do not apply the objective limit. */
3010 /** sets the pricing strategy of the LP solver (given the character representation of the strategy) */
3145 /* we don't check this parameter because SoPlex will always return its current random seed, not the initial one */
3356 SCIPmessageFPrintInfo(messagehdlr, file, "(obj: %.15g) [%.15g,%.15g], ", col->obj, col->lb, col->ub);
3370 /** sorts column entries such that LP rows precede non-LP rows and inside both parts lower row indices precede higher ones
3426 SCIPerrorMessage("coefficient for row <%s> doesn't exist in column <%s>\n", row->name, SCIPvarGetName(col->var));
3542 SCIP_CALL( rowChgCoefPos(row, blkmem, set, eventqueue, lp, col->linkpos[pos], col->vals[pos] + incval) );
3577 * @note: Here we only consider cancellations which can occur during decreasing the oldvalue to newvalue; not the
3616 if( SCIPsetIsLT(set, lp->objsqrnorm, 0.0) || isNewValueUnreliable(set, lp->objsqrnorm, oldvalue) )
3622 /* due to numerical troubles it still can appear that lp->objsqrnorm is a little bit smaller than 0 */
3648 SCIPsetDebugMsg(set, "changing objective value of column <%s> from %f to %f\n", SCIPvarGetName(col->var), col->obj, newobj);
3664 /* in any case, when the sign of the objective (and thereby the best bound) changes, the variable has to enter the
3678 /* update original objective value, as long as we are not in diving or probing and changed objective values */
3707 SCIPsetDebugMsg(set, "changing lower bound of column <%s> from %f to %f\n", SCIPvarGetName(col->var), col->lb, newlb);
3723 /* in any case, when the best bound is zero and gets changed, the variable has to enter the LP and the LP has to be
3752 SCIPsetDebugMsg(set, "changing upper bound of column <%s> from %f to %f\n", SCIPvarGetName(col->var), col->ub, newub);
3768 /* in any case, when the best bound is zero and gets changed, the variable has to enter the LP and the LP has to be
3966 /** calculates the Farkas coefficient y^T A_i of a column i using the given dual Farkas vector y */
4095 /** gets the Farkas value of a column in last LP (which must be infeasible), i.e. the Farkas coefficient y^T A_i times
4246 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
4288 /* if a loose variables has an infinite best bound, the LP bound is -infinity and no gain can be achieved */
4319 retcode = SCIPlpiStrongbranchInt(lp->lpi, col->lpipos, col->primsol, itlim, down == NULL ? NULL : &sbdown, up == NULL ? NULL : &sbup, &sbdownvalid, &sbupvalid, &iter);
4323 retcode = SCIPlpiStrongbranchFrac(lp->lpi, col->lpipos, col->primsol, itlim, down == NULL ? NULL : &sbdown, up == NULL ? NULL : &sbup, &sbdownvalid, &sbupvalid, &iter);
4357 iter = stat->ndualresolvelps > 0 ? (int)(2*stat->ndualresolvelpiterations / stat->ndualresolvelps)
4359 : stat->nprimalresolvelps > 0 ? (int)(2*stat->nprimalresolvelpiterations / stat->nprimalresolvelps)
4405 SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL;
4480 /* if a loose variables has an infinite best bound, the LP bound is -infinity and no gain can be achieved */
4519 SCIPsetDebugMsg(set, "performing strong branching on %d variables with %d iterations\n", ncols, itlim);
4523 retcode = SCIPlpiStrongbranchesInt(lp->lpi, lpipos, nsubcols, primsols, itlim, sbdown, sbup, sbdownvalid, sbupvalid, &iter);
4525 retcode = SCIPlpiStrongbranchesFrac(lp->lpi, lpipos, nsubcols, primsols, itlim, sbdown, sbup, sbdownvalid, sbupvalid, &iter);
4594 iter = stat->ndualresolvelps > 0 ? (int)(2*stat->ndualresolvelpiterations / stat->ndualresolvelps)
4596 : stat->nprimalresolvelps > 0 ? (int)(2*stat->nprimalresolvelpiterations / stat->nprimalresolvelps)
4628 * keep in mind, that the returned old values may have nothing to do with the current LP solution
4634 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
4638 SCIP_Real* solval, /**< stores LP solution value of column at last strong branching call, or NULL */
4658 /** if strong branching was already applied on the column at the current node, returns the number of LPs solved after
4673 /** marks a column to be not removable from the LP in the current node because it became obsolete */
4683 /* lpRemoveObsoleteCols() does not remove a column if the node number stored in obsoletenode equals the current node number */
4821 /** checks, whether the given scalar scales the given value to an integral number with error in the given bounds */
4826 SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
4827 SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
4860 * if the row's activity is proven to be integral, the sides are automatically rounded to the next integer
4871 SCIP_Bool integralcontvars, /**< should the coefficients of the continuous variables also be made integral,
4873 SCIP_Real minrounddelta, /**< minimal relative difference of scaled coefficient s*c and integral i,
4875 SCIP_Real maxrounddelta /**< maximal relative difference of scaled coefficient s*c and integral i
4899 SCIPsetDebugMsg(set, "scale row <%s> with %g (tolerance=[%g,%g])\n", row->name, scaleval, minrounddelta, maxrounddelta);
4907 /* scale the row coefficients, thereby recalculating whether the row's activity is always integral;
4908 * if the row coefficients are rounded to the nearest integer value, calculate the maximal activity difference,
4920 /* get local or global bounds for column, depending on the local or global feasibility of the row */
4984 /* scale the row sides, and move the constant to the sides; relax the sides with accumulated delta in order
5021 for( c = 0; c < row->len && SCIPcolIsIntegral(row->cols[c]) && SCIPsetIsIntegral(set, row->vals[c]); ++c )
5046 void* origin, /**< pointer to constraint handler or separator who created the row (NULL if unkown) */
5048 SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */
5058 * in case, for example, lhs > rhs but they are equal with tolerances, one could pass lhs=rhs=lhs+rhs/2 to
5234 SCIPmessageFPrintInfo(messagehdlr, file, "%+.15g<%s> ", row->vals[i], SCIPvarGetName(row->cols[i]->var));
5254 SCIPdebugMessage("capture row <%s> with nuses=%d and nlocks=%u\n", row->name, row->nuses, row->nlocks);
5272 SCIPsetDebugMsg(set, "release row <%s> with nuses=%d and nlocks=%u\n", (*row)->name, (*row)->nuses, (*row)->nlocks);
5284 /** locks an unmodifiable row, which forbids further changes; has no effect on modifiable rows */
5294 SCIPdebugMessage("lock row <%s> with nuses=%d and nlocks=%u\n", row->name, row->nuses, row->nlocks);
5299 /** unlocks a lock of an unmodifiable row; a row with no sealed lock may be modified; has no effect on modifiable rows */
5309 SCIPdebugMessage("unlock row <%s> with nuses=%d and nlocks=%u\n", row->name, row->nuses, row->nlocks);
5359 SCIPerrorMessage("coefficient for column <%s> doesn't exist in row <%s>\n", SCIPvarGetName(col->var), row->name);