Package util.objects

Examples of util.objects.StoredIndexedBipartiteSet


        this.slp = graph.getPathFinder();
        int left, right;
        for (int i = 0; i < offset; i++) {
            left = right = Integer.MIN_VALUE;
            for (int j = vs[i].getLB(); j <= vs[i].getUB(); j = vs[i].nextValue(j)) {
                StoredIndexedBipartiteSet sup = graph.getUBport(i, j);
                if (sup == null || sup.isEmpty()) {
                    if (j == right + 1) {
                        right = j;
                    } else {
                        vs[i].removeInterval(left, right, aCause);//, false);
                        left = right = j;
View Full Code Here


            return this;
        }

        @Override
        public void execute(int i) throws ContradictionException {
            StoredIndexedBipartiteSet support = p.graph.getUBport(idxVar, i);
            if (support != null) {
                final int[] list = support._getStructure();
                final int size = support.size();
                for (int j = 0; j < size; j++) {
                    int e = list[j];//t.next();
                    assert (p.graph.isInStack(e) == p.remContains(e));
                    if (!p.graph.isInStack(e)) {
                        p.graph.setInStack(e);
View Full Code Here

            double cost = 0.0;
            int[] str = new int[vars.length];
            for (int i = 0; i < vars.length - 1; i++) {
                found = false;
                str[i] = vars[i].getValue();
                StoredIndexedBipartiteSet bs = this.graph.GNodes.outArcs[first];
                DisposableIntIterator it = bs.getIterator();
                while (!found && it.hasNext()) {
                    int idx = it.next();
                    if (this.graph.GArcs.values[idx] == vars[i].getValue()) {
                        found = true;
                        first = this.graph.GArcs.dests[idx];
View Full Code Here

            return this;
        }

        @Override
        public void execute(int i) throws ContradictionException {
            StoredIndexedBipartiteSet sup = p.graph.getSupport(idxVar, i);
            if (sup != null) {
                DisposableIntIterator it = sup.getIterator();
                while (it.hasNext()) {
                    int arcId = it.next();
                    if (!p.graph.isInStack(arcId)) {
                        p.graph.setInStack(arcId);
                        p.toRemove.push(arcId);
View Full Code Here

            // DisposableIntIterator destIter = graph.layers[i].getIterator();
            //while (destIter.hasNext()) {
            for (int w = size - 1; w >= 0; w--) {
                //int dest = destIter.next();
                int dest = list[w];
                StoredIndexedBipartiteSet bs = graph.GNodes.inArcs[dest];
                assert (!bs.isEmpty());
                final int[] inlist = bs._getStructure();
                final int insize = bs.size();
                graph.GNodes.lpfs[dest] = Double.NEGATIVE_INFINITY;
                for (int x = 0; x < insize; x++) //while (in.hasNext())
                {
                    int e = inlist[x];//in.next();
                    if (!graph.isInStack(e)) {
                        int orig = graph.GArcs.origs[e];//e.getDestination();
                        double newCost = graph.GNodes.lpfs[orig] + getCost(e, resource, u, lagrange, max);//cost[graph.GNodes.layers[orig]][graph.GArcs.values[e]];

                        if (graph.GNodes.lpfs[dest] < newCost) {
                            graph.GNodes.lpfs[dest] = newCost;
                            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();
            final int[] list = graph.layers[i]._getStructure();
            final int size = graph.layers[i].size();
            //while(origIter.hasNext()){
            for (int w = size - 1; w >= 0; w--) {
                //int orig = origIter.next();
                int orig = list[w];
                StoredIndexedBipartiteSet bs = graph.GNodes.outArcs[orig];
                assert (!bs.isEmpty());

                final int[] outlist = bs._getStructure();//getIterator();
                final int outsize = bs.size();

                graph.GNodes.lpft[orig] = Double.NEGATIVE_INFINITY;
                for (int x = 0; x < outsize; x++) //while (out.hasNext())
                {
                    int e = outlist[x];//out.next();
View Full Code Here

            //while (destIter.hasNext()) {
            for (int w = size - 1; w >= 0; w--) {
                //int dest = destIter.next();
                int dest = list[w];
                graph.GNodes.spfs[dest] = Double.POSITIVE_INFINITY;
                StoredIndexedBipartiteSet bs = graph.GNodes.inArcs[dest];
                assert (!bs.isEmpty());
                final int[] inlist = bs._getStructure();
                final int insize = bs.size();

                for (int x = 0; x < insize; x++) //while (in.hasNext())
                {
                    int e = inlist[x];//in.next();
                    if (!graph.isInStack(e)) {
                        int orig = graph.GArcs.origs[e];//.getDestination();
                        double newCost = graph.GNodes.spfs[orig] + getCost(e, resource, u, lagrange, max);//cost[i][graph.GArcs.values[e]];
                        if (graph.GNodes.spfs[dest] > newCost) {
                            graph.GNodes.spfs[dest] = newCost;
                            graph.GNodes.prevSP[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();
            int[] list = graph.layers[i]._getStructure();
            int size = graph.layers[i].size();
            //while(origIter.hasNext()){
            for (int w = size - 1; w >= 0; w--) {
                //int orig = origIter.next();
                int orig = list[w];
                graph.GNodes.spft[orig] = Double.POSITIVE_INFINITY;
                StoredIndexedBipartiteSet bs = graph.GNodes.outArcs[orig];
                assert (!bs.isEmpty());
                final int[] outlist = bs._getStructure();//getIterator();
                final int outsize = bs.size();
                for (int x = 0; x < outsize; x++) //while (out.hasNext())
                {
                    int e = outlist[x];//out.next();
                    if (!graph.isInStack(e)) {
                        int dest = graph.GArcs.dests[e];//e.getOrigin()  ;
View Full Code Here

            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];
View Full Code Here

                //int dest = destIter.next();
                int dest = list[w];
                Arrays.fill(spfs[dest], Double.POSITIVE_INFINITY);
                Arrays.fill(lpfs[dest], Double.NEGATIVE_INFINITY);

                StoredIndexedBipartiteSet bs = graph.GNodes.inArcs[dest];
                assert (!bs.isEmpty());
                final int[] inlist = bs._getStructure();
                final int insize = bs.size();

                for (int x = 0; x < insize; x++) //while (in.hasNext())
                {
                    int e = inlist[x];//in.next();
                    if (!graph.isInStack(e)) {
                        int orig = graph.GArcs.origs[e];//.getDestination();
                        double[] cost = graph.GArcs.originalCost[e];
//                        double[] newCost = addArray(spfs[orig],cost);//cost[i][graph.GArcs.values[e]];
                        for (int d = 0; d < nbr; d++) {
                            if (spfs[dest][d] > cost[d] + spfs[orig][d]) {
                                spfs[dest][d] = cost[d] + spfs[orig][d];
                                prevSP[dest][d] = e;
                                update = true;
                            }
                            if (lpfs[dest][d] < lpfs[orig][d] + cost[d]) {
                                lpfs[dest][d] = lpfs[orig][d] + cost[d];
                                prevLP[dest][d] = 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();
            int[] list = graph.layers[i]._getStructure();
            int size = graph.layers[i].size();
            //while(origIter.hasNext()){
            for (int w = size - 1; w >= 0; w--) {
                //int orig = origIter.next();
                int orig = list[w];
                Arrays.fill(spft[orig], Double.POSITIVE_INFINITY);
                Arrays.fill(lpft[orig], Double.NEGATIVE_INFINITY);
                StoredIndexedBipartiteSet bs = graph.GNodes.outArcs[orig];
                assert (!bs.isEmpty());
                final int[] outlist = bs._getStructure();//getIterator();
                final int outsize = bs.size();
                for (int x = 0; x < outsize; x++) //while (out.hasNext())
                {
                    int e = outlist[x];//out.next();
                    if (!graph.isInStack(e)) {
                        int dest = graph.GArcs.dests[e];//e.getOrigin()  ;
View Full Code Here

                sups[idx].add(a.id);
            }

        }

        this.inGraph = new StoredIndexedBipartiteSet(environment, inginit);
        // this.inGraph = constraint.getSolver().getEnvironment().makeBitSet(arcs.size());
//        this.inGraph.set(0,arcs.size());
        // System.out.println(this.inGraph.size());
        for (int i = 0; i < sups.length; i++) {
            if (sups[i] != null)
View Full Code Here

TOP

Related Classes of util.objects.StoredIndexedBipartiteSet

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.