Class IntLinCombFactory


  • public class IntLinCombFactory
    extends Object
    A factory to reduce and detect specific cases related to integer linear combinations.

    It aims at first reducing the input (merge coefficients) and then select the right implementation (for performance concerns).

    2015.09.24 (cprudhom) dealing with tuples is only relevant for scalar in some very specific cases (eg. mzn 2014, elitserien+handball+handball14.fzn)

    Created by cprudhom on 13/11/14. Project: choco.

    Author:
    Charles Prud'homme
    • Method Detail

      • reduce

        public static Constraint reduce​(IntVar[] VARS,
                                        Operator OPERATOR,
                                        IntVar SUM,
                                        int minCardForDecomposition)
        Reduce coefficients, and variables if required, when dealing with a sum (all coefficients are implicitly equal to 1)
        Parameters:
        VARS - array of integer variables
        OPERATOR - an operator among "=", "!=", ">", "<", ">=",>" and "<="
        SUM - the resulting variable
        Returns:
        a constraint to post or reify
      • reduce

        public static Constraint reduce​(IntVar[] VARS,
                                        int[] COEFFS,
                                        Operator OPERATOR,
                                        IntVar SCALAR,
                                        int minCardForDecomposition)
        Reduce coefficients, and variables if required, when dealing with a scalar product
        Parameters:
        VARS - array of integer variables
        COEFFS - array of integers
        OPERATOR - an operator among "=", "!=", ">", "<", ">=",>" and "<="
        SCALAR - the resulting variable
        Returns:
        a constraint to post or reify
      • selectSum

        public static Constraint selectSum​(IntVar[] VARS,
                                           int[] COEFFS,
                                           Operator OPERATOR,
                                           int RESULT,
                                           int nbools)
        Select the most relevant Sum constraint to return
        Parameters:
        VARS - array of integer variables
        COEFFS - array of integers
        OPERATOR - on operator
        RESULT - an integer
        nbools - number of boolean variables
        Returns:
        a constraint
      • selectScalar

        public static Constraint selectScalar​(IntVar[] VARS,
                                              int[] COEFFS,
                                              Operator OPERATOR,
                                              int RESULT)
        Select the most relevant ScalarProduct constraint to return
        Parameters:
        VARS - array of integer variables
        COEFFS - array of integers
        OPERATOR - on operator
        RESULT - an integer
        Returns:
        a constraint