Interface IReificationFactory

  • All Superinterfaces:
    ISelf<Model>
    All Known Subinterfaces:
    IModel
    All Known Implementing Classes:
    Model

    public interface IReificationFactory
    extends ISelf<Model>
    Interface to reify constraints A kind of factory relying on interface default implementation to allow (multiple) inheritance
    Since:
    4.0.0
    Author:
    Jean-Guillaume FAGES
    • Method Detail

      • ifThenElse

        default void ifThenElse​(Constraint ifCstr,
                                Constraint thenCstr,
                                Constraint elseCstr)
        Posts a constraint ensuring that if ifCstr is satisfied, then thenCstr must be satisfied as well Otherwise, elseCstr must be satisfied ifCstr => ThenCstr not(ifCstr) => ElseCstr BEWARE : it is automatically posted (it cannot be reified)
        Parameters:
        ifCstr - a constraint
        thenCstr - a constraint
        elseCstr - a constraint
      • ifThenElse

        default void ifThenElse​(BoolVar ifVar,
                                Constraint thenCstr,
                                Constraint elseCstr)
        Posts an implication constraint: ifVar => thenCstr && not(ifVar) => elseCstr.
        Ensures:

        - ifVar = 1 => thenCstr is satisfied,

        - ifVar = 0 => elseCstr is satisfied,

        - thenCstr is not satisfied => ifVar = 0

        - elseCstr is not satisfied => ifVar = 1

        In order to get ifVar <=> thenCstr, use reification BEWARE : it is automatically posted (it cannot be reified)

        Parameters:
        ifVar - variable of reification
        thenCstr - the constraint to be satisfied when ifVar = 1
        elseCstr - the constraint to be satisfied when ifVar = 0
      • ifThen

        default void ifThen​(Constraint ifCstr,
                            Constraint thenCstr)
        Posts a constraint ensuring that if ifCstr is satisfied, then thenCstr is satisfied as well BEWARE : it is automatically posted (it cannot be reified)
        Parameters:
        ifCstr - a constraint
        thenCstr - a constraint
      • ifThen

        default void ifThen​(BoolVar ifVar,
                            Constraint thenCstr)
        Posts an implication constraint: ifVar => thenCstr Also called half reification constraint Ensures:

        - ifVar = 1 => thenCstr is satisfied,

        - thenCstr is not satisfied => ifVar = 0

        Example :
        - ifThen(b1, arithm(v1, "=", 2));: b1 is equal to 1 => v1 = 2, so v1 != 2 => b1 is equal to 0 But if b1 is equal to 0, nothing happens BEWARE : it is automatically posted (it cannot be reified)

        Parameters:
        ifVar - variable of reification
        thenCstr - the constraint to be satisfied when ifVar = 1
      • ifOnlyIf

        default void ifOnlyIf​(Constraint cstr1,
                              Constraint cstr2)
        Posts an equivalence constraint stating that cstr1 is satisfied <=> cstr2 is satisfied, BEWARE : it is automatically posted (it cannot be reified)
        Parameters:
        cstr1 - a constraint to be satisfied if and only if cstr2 is satisfied
        cstr2 - a constraint to be satisfied if and only if cstr1 is satisfied
      • reification

        default void reification​(BoolVar var,
                                 Constraint cstr)
        Reify a constraint with a boolean variable: var = 1 <=> cstr is satisfied, Equivalent to ifOnlyIf BEWARE : it is automatically posted (it cannot be reified)
        Parameters:
        var - variable of reification
        cstr - the constraint to be satisfied if and only if var = 1
      • reifyXeqC

        default void reifyXeqC​(IntVar X,
                               int C,
                               BoolVar B)
        Posts one constraint that expresses : (x = c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - a integer variable
        C - an int
        B - a boolean variable
      • reifyXneC

        default void reifyXneC​(IntVar X,
                               int C,
                               BoolVar B)
        Posts one constraint that expresses : (x ≠ c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - a integer variable
        C - an int
        B - a boolean variable
      • reifyXeqY

        default void reifyXeqY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x = y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXneY

        default void reifyXneY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x ≠ y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXeqYC

        default void reifyXeqYC​(IntVar X,
                                IntVar Y,
                                int C,
                                BoolVar B)
        Posts one constraint that expresses : (x = y + c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        C - an int
        B - a boolean variable
      • reifyXneYC

        default void reifyXneYC​(IntVar X,
                                IntVar Y,
                                int C,
                                BoolVar B)
        Posts one constraint that expresses : (x ≠ y + c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        C - an int
        B - a boolean variable
      • reifyXltC

        default void reifyXltC​(IntVar X,
                               int C,
                               BoolVar B)
        Posts one constraint that expresses : (x < c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - a integer variable
        C - an int
        B - a boolean variable
      • reifyXgtC

        default void reifyXgtC​(IntVar X,
                               int C,
                               BoolVar B)
        Posts one constraint that expresses : (x > c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - a integer variable
        C - an int
        B - a boolean variable
      • reifyXltY

        default void reifyXltY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x < y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXgtY

        default void reifyXgtY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x > y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXleY

        default void reifyXleY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x ≤ y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXgeY

        default void reifyXgeY​(IntVar X,
                               IntVar Y,
                               BoolVar B)
        Posts one constraint that expresses : (x ≥ y) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        B - a boolean variable
      • reifyXltYC

        default void reifyXltYC​(IntVar X,
                                IntVar Y,
                                int C,
                                BoolVar B)
        Posts one constraint that expresses : (x < y + c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        C - an int
        B - a boolean variable
      • reifyXgtYC

        default void reifyXgtYC​(IntVar X,
                                IntVar Y,
                                int C,
                                BoolVar B)
        Posts one constraint that expresses : (x > y + c) ⇔ b. Bypasses the reification system.
        Parameters:
        X - an integer variable
        Y - an integer variable
        C - an int
        B - a boolean variable
      • reifyXinS

        default void reifyXinS​(IntVar X,
                               IntIterableRangeSet S,
                               BoolVar B)
        Posts one constraint that expresses : (X ∈ S) ⇔ B. Bypasses the reification system.
        Parameters:
        X - an integer variable
        S - a set of values
        B - a boolean variable
      • reifyXnotinS

        default void reifyXnotinS​(IntVar X,
                                  IntIterableRangeSet S,
                                  BoolVar B)
        Posts one constraint that expresses : (X ∉ S) ⇔ B. Bypasses the reification system.
        Parameters:
        X - an integer variable
        S - a set of values
        B - a boolean variable