Package solver.constraints.nary.sum

Examples of solver.constraints.nary.sum.Scalar


            return makeScalar(VARS2, COEFFS2, VARS[idx], -COEFFS[idx]);
        } else {
            if (tupleIt(VARS) && SCALAR.hasEnumeratedDomain()) {
                return table(ArrayUtils.append(VARS, new IntVar[]{SCALAR}), TuplesFactory.scalar(VARS, COEFFS, SCALAR, SCALAR_COEF), "");
            } else {
                return new Scalar(VARS, COEFFS, SCALAR, SCALAR_COEF);
            }
        }
    }
View Full Code Here


            Solver solver = new Solver();
            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, ref);
                IntVar y = VariableFactory.enumerated("y", 0, 2, ref);
                IntVar z = VariableFactory.enumerated("z", 0, 4, ref);
                ref.post(new Scalar(new IntVar[]{x, y}, new int[]{1, 1}, z, 1));
                ref.set(IntStrategyFactory.random_value(new IntVar[]{x, y, z}, seed));

            }
            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, solver);
View Full Code Here

            Solver solver = new Solver();
            {
                IntVar x = VariableFactory.bounded("x", 0, 2, ref);
                IntVar y = VariableFactory.bounded("y", 0, 2, ref);
                IntVar z = VariableFactory.bounded("z", 0, 4, ref);
                ref.post(new Scalar(new IntVar[]{x, y}, new int[]{1, 1}, z, 1));
                ref.set(IntStrategyFactory.random_bound(new IntVar[]{x, y, z}, seed));

            }
            {
                IntVar x = VariableFactory.bounded("x", 0, 2, solver);
View Full Code Here

            Solver solver = new Solver();
            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, ref);
                IntVar y = VariableFactory.enumerated("y", 0, 2, ref);
                IntVar z = VariableFactory.enumerated("z", -2, 2, ref);
                Constraint cstr = new Scalar(new IntVar[]{x, y}, new int[]{1, -1}, z, 1);
//        System.out.println(cstr);
                ref.post(cstr);
                ref.set(IntStrategyFactory.random_value(new IntVar[]{x, y, z}, seed));

            }
View Full Code Here

            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, ref);
                IntVar y = VariableFactory.enumerated("y", 0, 2, ref);
                IntVar z = VariableFactory.enumerated("z", -2, 2, ref);
                IntVar az = VariableFactory.enumerated("az", 0, 2, ref);
                ref.post(new Scalar(new IntVar[]{x, y}, new int[]{1, -1}, z, 1));
                ref.post(IntConstraintFactory.absolute(az, z));
                ref.set(IntStrategyFactory.random_bound(new IntVar[]{x, y, az}, seed));
            }
            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, solver);
View Full Code Here

            {
                IntVar x = VariableFactory.enumerated("x", 0, 2, ref);
                IntVar y = VariableFactory.enumerated("y", 0, 2, ref);
                IntVar z = VariableFactory.enumerated("z", -2, 2, ref);
                IntVar az = VariableFactory.enumerated("az", 0, 2, ref);
                ref.post(new Scalar(new IntVar[]{x, y}, new int[]{1, -1}, z, 1));
                ref.post(IntConstraintFactory.absolute(az, z));
                ref.post(IntConstraintFactory.alldifferent(new IntVar[]{x, y, az}, "BC"));
                ref.set(IntStrategyFactory.random_bound(new IntVar[]{x, y, az}, seed));
            }
            {
View Full Code Here

            {
                IntVar[] x = VariableFactory.enumeratedArray("x", k, 0, k - 1, ref);
                IntVar[] y = VariableFactory.enumeratedArray("y", k - 1, -(k - 1), k - 1, ref);
                IntVar[] t = VariableFactory.enumeratedArray("t", k - 1, 0, k - 1, ref);
                for (int i = 0; i < k - 1; i++) {
                    ref.post(new Scalar(new IntVar[]{x[i + 1], x[i]}, new int[]{1, -1}, y[i], 1));
                    ref.post(IntConstraintFactory.absolute(t[i], y[i]));
                }
                ref.post(IntConstraintFactory.alldifferent(x, "BC"));
                ref.post(IntConstraintFactory.alldifferent(t, "BC"));
                ref.post(IntConstraintFactory.arithm(x[1], ">", x[0]));
View Full Code Here

TOP

Related Classes of solver.constraints.nary.sum.Scalar

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.