/* * We have a new solution for subprob a,b with weight w, using i,j. If it is * better than previous solutions, we update. We assume that a<b and i < j. */ public void update(int a, int b, int w, int i, int j) { // System.out.print("update("+a+","+b+" w:"+w+" "+i+","+j+")"); int ow = subD.weight(a, b); if (w <= ow) { PairDeque pair = subD.pairs(a, b); if (w < ow) { pair.flush(); subD.setWeight(a, b, w); } pair.pushNarrow(i, j); } }