Given the current LP solution, , this method searches
for violated logical constraints of the form
(3) |
const double* sol = si->getColSolution();
Then, we check if . If a violation is found, we construct the logical constraint as a CoinPackedVector and add it to the current LP using si->addRow().
for(i = 0; i < M; i++){ for(j = 0; j < N; j++){ xind = xindex(i,j); yind = yindex(j); if(sol[xind] - (demand[i] * sol[yind]) > tolerance){ //Then, we have a violated constraint - so add it. CoinPackedVector cut; cut.insert(xind, 1.0); cut.insert(yind, -1.0 * demand[i]); si->addRow(cut, -1.0 * si->getInfinity(), 0.0); } } }