}
}
for (int i = 1; i <= nbLayer; i++) {
update = false;
DisposableIntIterator destIter = graph.layers[i].getIterator();
while (destIter.hasNext()) {
int dest = destIter.next();
graph.GNodes.spfs[dest] = Double.POSITIVE_INFINITY;
graph.GNodes.lpfs[dest] = Double.NEGATIVE_INFINITY;
StoredIndexedBipartiteSet bs = graph.GNodes.inArcs[dest];
assert (!bs.isEmpty());
DisposableIntIterator in = bs.getIterator();
while (in.hasNext()) {
int e = in.next();
if (!graph.isInStack(e)) {
int orig = graph.GArcs.origs[e];//.getDestination();
double cost = getCost(e, resource, u, lagrange, max);
double newCost = graph.GNodes.spfs[orig] + cost;//cost[i][graph.GArcs.values[e]];
if (graph.GNodes.spfs[dest] > newCost) {
graph.GNodes.spfs[dest] = newCost;
graph.GNodes.prevSP[dest] = e;
update = true;
}
double newCost2 = graph.GNodes.lpfs[orig] + cost;//cost[graph.GNodes.layers[n]][graph.GArcs.values[e]];
if (graph.GNodes.lpfs[dest] < newCost2) {
graph.GNodes.lpfs[dest] = newCost2;
graph.GNodes.prevLP[dest] = e;
update = true;
}
}
}
in.dispose();
}
destIter.dispose();
if (!update) propagator.contradiction(null, "no update");
}
for (int i = nbLayer - 1; i >= 0; i--) {
update = false;
DisposableIntIterator origIter = graph.layers[i].getIterator();
while (origIter.hasNext()) {
int orig = origIter.next();
graph.GNodes.spft[orig] = Double.POSITIVE_INFINITY;
graph.GNodes.lpft[orig] = Double.NEGATIVE_INFINITY;
StoredIndexedBipartiteSet bs = graph.GNodes.outArcs[orig];
assert (!bs.isEmpty());
DisposableIntIterator out = bs.getIterator();//getInEdgeIterator(n);
while (out.hasNext()) {
int e = out.next();
if (!graph.isInStack(e)) {
int dest = graph.GArcs.dests[e];//e.getOrigin() ;
double cost = graph.GArcs.temporaryCost[e];
double newCost = graph.GNodes.spft[dest] + cost;//cost[graph.GNodes.layers[next]][graph.GArcs.values[e]];
if (newCost + graph.GNodes.spfs[orig] - ub >= Configuration.MCR_DECIMAL_PREC) {
graph.getInStack().set(e);
removed.add(e);
} else if (graph.GNodes.spft[orig] > newCost) {
graph.GNodes.spft[orig] = newCost;
graph.GNodes.nextSP[orig] = e;
update = true;
}
double newCost2 = graph.GNodes.lpft[dest] + cost;//cost[graph.GNodes.layers[next]][graph.GArcs.values[e]];
if (newCost2 + graph.GNodes.lpfs[orig] - lb <= -Configuration.MCR_DECIMAL_PREC) {
graph.setInStack(e);
removed.add(e);
} else if (graph.GNodes.lpft[orig] < newCost2) {
graph.GNodes.lpft[orig] = newCost2;
graph.GNodes.nextLP[orig] = e;
update = true;
}
}
}
out.dispose();
}
origIter.dispose();
if (!update) propagator.contradiction(null, "no update");
}