Class KElement


  • public class KElement
    extends KConstraint
    This class creates a x == tab[i + cste] constraint

    Example :
    
    KIntArray tab(...);
    KIntVar x(...);
    KIntVar i(...);
    // ...
    problem.post(KElement(tab,i,x,4,"x == tab[i + 4]"));
    

    Since:
    2016.1
    See Also:
    KConstraint

    • Constructor Detail

      • KElement

        protected KElement​(long cPtr,
                           boolean cMemoryOwn)
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        KIntVar x,
                        int offset,
                        java.lang.String name)
        Constructor for `x == tab[i + cste]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value variable
        offset - constant offset of index
        name - name of the constraint
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        KIntVar x,
                        int offset)
        Constructor for `x == tab[i + cste]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value variable
        offset - constant offset of index
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        KIntVar x,
                        java.lang.String name)
        Constructor for `x == tab[i]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value variable
        name - name of the constraint
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        KIntVar x)
        Constructor for `x == tab[i]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value variable
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        int x,
                        int offset,
                        java.lang.String name)
        Constructor for `x == tab[i + cste]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value constant
        offset - constant offset of index
        name - name of the constraint
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        int x,
                        int offset)
        Constructor for `x == tab[i + cste]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value constant
        offset - constant offset of index
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        int x,
                        java.lang.String name)
        Constructor for `x == tab[i]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value constant
        name - name of the constraint
      • KElement

        public KElement​(KIntArray tab,
                        KIntVar i,
                        int x)
        Constructor for `x == tab[i]`
        Parameters:
        tab - the values
        i - the index variable
        x - the value constant
      • KElement

        public KElement​(KIntVar i,
                        KIntVar x,
                        KIntArray starts,
                        KIntArray ends,
                        KIntArray values,
                        int offset,
                        java.lang.String name)
        Constructor for `x = D[i + offset]` with `D` being a sparse interval map.

        Given a list of intervals `[s_i, e_i)` with associated values `v_i`, then
        `s_i <= y < e_i => D[y] = v_i`

        Parameters:
        i - t
        x - the value variable
        starts - Interval starts `s_i`
        ends - Interval ends `e_i`
        values - Interval values `v_i`
        offset - potential offset for the indxing variable
        name - name of the constraint
      • KElement

        public KElement​(KIntVar i,
                        KIntVar x,
                        KIntArray starts,
                        KIntArray ends,
                        KIntArray values,
                        int offset)
        Constructor for `x = D[i + offset]` with `D` being a sparse interval map.

        Given a list of intervals `[s_i, e_i)` with associated values `v_i`, then
        `s_i <= y < e_i => D[y] = v_i`

        Parameters:
        i - t
        x - the value variable
        starts - Interval starts `s_i`
        ends - Interval ends `e_i`
        values - Interval values `v_i`
        offset - potential offset for the indxing variable
      • KElement

        public KElement​(KIntVar i,
                        KIntVar x,
                        KIntArray starts,
                        KIntArray ends,
                        KIntArray values)
        Constructor for `x = D[i + offset]` with `D` being a sparse interval map.

        Given a list of intervals `[s_i, e_i)` with associated values `v_i`, then
        `s_i <= y < e_i => D[y] = v_i`

        Parameters:
        i - t
        x - the value variable
        starts - Interval starts `s_i`
        ends - Interval ends `e_i`
        values - Interval values `v_i`

      • KElement

        public KElement​(KEltTerm e,
                        KIntVar x,
                        java.lang.String name)
      • KElement

        public KElement​(KEltTerm e,
                        int x,
                        java.lang.String name)
      • KElement

        public KElement​(KEltTerm e,
                        int x)
      • KElement

        public KElement​(KElement toCopy)
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KElement obj)
      • getValueForIndex

        public int getValueForIndex​(int index)
      • setUseValueFunction

        public void setUseValueFunction​(boolean useValueFunction)
      • getConstraintIPtr

        public com.artelys.kalis.SWIGTYPE_p_void getConstraintIPtr()