Package util.iterators

Examples of util.iterators.DisposableIntIterator


    public void updateSPFS(int nid, TIntStack toRemove, Propagator<IntVar> propagator) {


        double tempPval = Double.POSITIVE_INFINITY;
        int tempP = Integer.MIN_VALUE;
        DisposableIntIterator it = GNodes.inArcs[nid].getIterator();


        while (it.hasNext()) {
            int arcId = it.next();
            int orig = GArcs.origs[arcId];
            double spfs = GNodes.spfs.quickGet(orig) + GArcs.costs[arcId];
            if (tempPval > spfs) {
                tempPval = spfs;
                tempP = arcId;
            }

        }
        it.dispose();
        double old = GNodes.spfs.quickSet(nid, tempPval);
        GNodes.prevSP.quickSet(nid, tempP);

        if (nid != tinkIndex && old != tempPval) {
            it = GNodes.outArcs[nid].getIterator();

            while (it.hasNext()) {
                int arcId = it.next();
                int dest = GArcs.dests[arcId];
                if (GNodes.prevSP.quickGet(dest) == arcId) {
                    updateSPFS(dest, toRemove, propagator);
                }
                double spft = GNodes.spft.quickGet(dest);
                double acost = GArcs.costs[arcId];
                if (!isInStack(arcId) && tempPval + spft + acost > propagator.getVar(starts.length).getUB()) {
                    setInStack(arcId);
                    toRemove.push(arcId);
                }
            }
            it.dispose();
        }

    }
View Full Code Here


    public void updateLPFS(int nid, TIntStack toRemove, Propagator<IntVar> propagator) {


        double tempPval = Double.NEGATIVE_INFINITY;
        int tempP = Integer.MIN_VALUE;
        DisposableIntIterator it = GNodes.inArcs[nid].getIterator();


        while (it.hasNext()) {
            int arcId = it.next();
            int orig = GArcs.origs[arcId];
            double lpfs = GNodes.lpfs.quickGet(orig) + GArcs.costs[arcId];
            if (tempPval < lpfs) {
                tempPval = lpfs;
                tempP = arcId;
            }

        }
        it.dispose();
        double old = GNodes.lpfs.quickSet(nid, tempPval);
        GNodes.prevLP.quickSet(nid, tempP);


        if (nid != tinkIndex && old != tempPval) {
            it = GNodes.outArcs[nid].getIterator();

            while (it.hasNext()) {
                int arcId = it.next();
                int dest = GArcs.dests[arcId];
                if (GNodes.prevLP.quickGet(dest) == arcId) {
                    updateLPFS(dest, toRemove, propagator);
                }
                double lpft = GNodes.lpft.quickGet(dest);
                double acost = GArcs.costs[arcId];
                if (!isInStack(arcId) && tempPval + lpft + acost < propagator.getVar(starts.length).getLB()) {
                    setInStack(arcId);
                    toRemove.push(arcId);
                }
            }
            it.dispose();
        }

    }
View Full Code Here

TOP

Related Classes of util.iterators.DisposableIntIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.