Package java.util

Examples of java.util.BitSet.nextSetBit()


            }
            seti.set(i, false);
            int y = rand.nextInt(size);
            int j = seti.nextSetBit(y);
            if (j == -1) {
                j = seti.nextSetBit(0);
            }
            if (j != -1) {
                seti.set(j, false);
                graph[i][j] = true;
                nb--;
View Full Code Here



        // on bouche jusqu'a la limite pour creer les contraintes 1
        while (nbPrec > 0) {
            //Pair p = precs.get(rand.nextInt(precs.size()));
            int ij = precs.nextSetBit(0);
            int index = rand.nextInt(precs.cardinality());
            while (index > 0) {
                ij = precs.nextSetBit(ij + 1);
                index--;
            }
View Full Code Here

        while (nbPrec > 0) {
            //Pair p = precs.get(rand.nextInt(precs.size()));
            int ij = precs.nextSetBit(0);
            int index = rand.nextInt(precs.cardinality());
            while (index > 0) {
                ij = precs.nextSetBit(ij + 1);
                index--;
            }
            assert (ij > -1);
            graph[ij / n][ij % n] = 1;
            precs.set(ij, false);
View Full Code Here

            }
            seti.set(i, false);
            int ti = nb - ni;
            while (ti > 0) {
                int y = rand.nextInt(size);
                int j = seti.nextSetBit(y);
                if (j == -1) {
                    j = seti.nextSetBit(0);
                }
                seti.set(j, false);
                graph[i][j] = true;
View Full Code Here

            int ti = nb - ni;
            while (ti > 0) {
                int y = rand.nextInt(size);
                int j = seti.nextSetBit(y);
                if (j == -1) {
                    j = seti.nextSetBit(0);
                }
                seti.set(j, false);
                graph[i][j] = true;
                ti--;
            }
View Full Code Here

            int i = pickOneTrue(notIn);
            notIn.set(i, false);
            // relier i a un sommet de in quelconque.
            int j;
            int sj = rand.nextInt(size);
            j = in.nextSetBit(sj);
            if (j == -1) {
                j = in.nextSetBit(0);
            }
            // cas du premier sommet ajoute dans in
            if (j > -1) {
View Full Code Here

            // relier i a un sommet de in quelconque.
            int j;
            int sj = rand.nextInt(size);
            j = in.nextSetBit(sj);
            if (j == -1) {
                j = in.nextSetBit(0);
            }
            // cas du premier sommet ajoute dans in
            if (j > -1) {
                // pas de pbs car i et j ne peuvent pas etre tous deux dans in
                this.graph[i][j] = true;
View Full Code Here

        // on bouche jusqu'a la limite pour creer les contraintes 2
        BitSet neqs = new BitSet();
        neqs.or(precs);
        while (nbNeq > 0 && neqs.cardinality() > 0) {
            int ij = neqs.nextSetBit(0);
            int index = rand.nextInt(neqs.cardinality());
            while (index > 0) {
                ij = neqs.nextSetBit(ij + 1);
                index--;
            }
View Full Code Here

        neqs.or(precs);
        while (nbNeq > 0 && neqs.cardinality() > 0) {
            int ij = neqs.nextSetBit(0);
            int index = rand.nextInt(neqs.cardinality());
            while (index > 0) {
                ij = neqs.nextSetBit(ij + 1);
                index--;
            }
            assert (ij > -1);
            graph[ij / n][ij % n] = 2;
            neqs.set(ij, false);
View Full Code Here

        }

        for (int i = 0; i < alldiffLayers.length; i++) {
            BitSet disjoint = alldiffLayers[i];
            IntVar[] tvars = new IntVar[disjoint.cardinality()];
            for (int k = 0, j = disjoint.nextSetBit(0); j >= 0; j = disjoint.nextSetBit(j + 1), k++) {
                tvars[k] = vars[j];
            }
            solver.post(IntConstraintFactory.alldifferent(tvars, "BC"));
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.