Package solver.variables

Examples of solver.variables.SetVar


    // METHODS
    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        SetVar intersection = vars[k];
        if (PropagatorEventType.isFullPropagation(evtmask)) {
            for (int j = vars[0].getKernelFirst(); j != SetVar.END; j = vars[0].getKernelNext()) {
                boolean all = true;
                for (int i = 1; i < k; i++) {
                    if (!vars[i].kernelContains(j)) {
                        all = false;
                        break;
                    }
                }
                if (all) {
                    intersection.addToKernel(j, aCause);
                }
            }
            for (int j = intersection.getEnvelopeFirst(); j != SetVar.END; j = intersection.getEnvelopeNext()) {
                if (intersection.kernelContains(j)) {
                    for (int i = 0; i < k; i++) {
                        vars[i].addToKernel(j, aCause);
                    }
                } else {
                    for (int i = 0; i < k; i++)
                        if (!vars[i].envelopeContains(j)) {
                            intersection.removeFromEnvelope(j, aCause);
                            break;
                        }
                }
            }
            // ------------------
View Full Code Here


            for (int i = 0; i < size; i++) {
                vars[i].duplicate(solver, identitymap);
                svars[i] = (SetVar) identitymap.get(vars[i]);
            }
            vars[k].duplicate(solver, identitymap);
            SetVar I = (SetVar) identitymap.get(vars[k]);
            identitymap.put(this, new PropIntersection(svars, I));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            iv.duplicate(solver, identitymap);
            IntVar I = (IntVar) identitymap.get(iv);

            identitymap.put(this, new PropIntMemberSet(S,I));
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            card.duplicate(solver, identitymap);
            IntVar C = (IntVar) identitymap.get(card);

            identitymap.put(this, new PropCardinality(S, C));
View Full Code Here

    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        if (PropagatorEventType.isFullPropagation(evtmask)) {
            SetVar union = vars[k];
            for (int i = 0; i < k; i++) {
                for (int j = vars[i].getKernelFirst(); j != SetVar.END; j = vars[i].getKernelNext())
                    union.addToKernel(j, aCause);
                for (int j = vars[i].getEnvelopeFirst(); j != SetVar.END; j = vars[i].getEnvelopeNext())
                    if (!union.envelopeContains(j))
                        vars[i].removeFromEnvelope(j, aCause);
            }
            for (int j = union.getEnvelopeFirst(); j != SetVar.END; j = union.getEnvelopeNext()) {
                if (union.kernelContains(j)) {
                    int mate = -1;
                    for (int i = 0; i < k && mate != -2; i++) {
                        if (vars[i].envelopeContains(j)) {
                            if (mate == -1) {
                                mate = i;
                            } else {
                                mate = -2;
                            }
                        }
                    }
                    if (mate == -1) {
                        contradiction(vars[k], "");
                    } else if (mate != -2) {
                        vars[mate].addToKernel(j, aCause);
                    }
                } else {
                    int mate = -1;
                    for (int i = 0; i < k; i++) {
                        if (vars[i].envelopeContains(j)) {
                            mate = i;
                            break;
                        }
                    }
                    if (mate == -1) union.removeFromEnvelope(j, aCause);
                }
            }
            // ------------------
      for (int i = 0; i <= k; i++)
        sdm[i].unfreeze();
View Full Code Here

            for (int i = 0; i < size; i++) {
                vars[i].duplicate(solver, identitymap);
                svars[i] = (SetVar) identitymap.get(vars[i]);
            }
            vars[size].duplicate(solver, identitymap);
            SetVar svar = (SetVar) identitymap.get(vars[size]);

            identitymap.put(this, new PropUnion(svars, svar));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            max.duplicate(solver, identitymap);
            IntVar M = (IntVar) identitymap.get(max);

            identitymap.put(this, new PropMaxElement(S, M, notEmpty));
View Full Code Here

            for (int i = 0; i < size; i++) {
                this.bools[i].duplicate(solver, identitymap);
                aVars[i] = (BoolVar) identitymap.get(this.bools[i]);
            }
            this.set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(this.set);
            identitymap.put(this, new PropBoolChannel(S, aVars, this.offSet));
        }
    }
View Full Code Here

    @Override
    public void duplicate(Solver solver, THashMap<Object, Object> identitymap) {
        if (!identitymap.containsKey(this)) {
            set.duplicate(solver, identitymap);
            SetVar S = (SetVar) identitymap.get(set);

            min.duplicate(solver, identitymap);
            IntVar M = (IntVar) identitymap.get(min);

            identitymap.put(this, new PropMinElement(S, M, notEmpty));
View Full Code Here

            }
            ub = index.getUB();
            // filter set (constructive disjunction)
            if (noEmptyKer) {// from ker
                constructiveDisjunction.clear();
                SetVar v = array[index.getLB() - offSet];
                for (int j = v.getKernelFirst(); j != SetVar.END; j = v.getKernelNext()) {
                    if (!set.kernelContains(j)) {
                        constructiveDisjunction.add(j);
                    }
                }
                for (int cd = constructiveDisjunction.size() - 1; cd >= 0; cd--) {
View Full Code Here

TOP

Related Classes of solver.variables.SetVar

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.