next up previous
Next: UFL::generate_cuts_CGL() Up: UFL::simulate_root Previous: UFL::find_upperbound()

UFL::generate_cuts()

Given the current LP solution, $x^{*}, y^{*}$, this method searches for violated logical constraints of the form

\begin{displaymath}x_{ij} - d_i y_j \leq 0.\end{displaymath} (3)

First we get the current solution.

  const double* sol = si->getColSolution();

Then, we check if $x^{*}_{ij} - d_i y^{*}_j > \epsilon, \forall i \in M, j
\in N$. 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);
      }
    }
  }



IP Seminar Series 2004-01-11