Class KElement2D


  • public class KElement2D
    extends KConstraint
    This class creates a X == Tab[I + cste1][J + cste2] constraint

    Example :
    
    KIntArray Tab(...);
    KIntVar X(...);
    KIntVar I(...);
    KIntVar J(...);
    // ...
    problem.post(KElement2D(Tab, I, J, X, 4, 8, "X == Tab[I + 4][J+8]"));
    

    Since:
    2016.1
    See Also:
    KConstraint

    • Constructor Detail

      • KElement2D

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

        public KElement2D​(KIntMatrix matrix,
                          KIntVar I,
                          KIntVar J,
                          KIntVar X,
                          int offset1,
                          int offset2,
                          java.lang.String name)
        Primary Constructor
        Parameters:
        matrix - the values
        I - the first index variable
        J - the second index variable
        X - the value variable
        offset1 - constant offset of first index variable
        offset2 - constant offset of second index variable
        name - name of the constraint
      • KElement2D

        public KElement2D​(KIntMatrix matrix,
                          KIntVar I,
                          KIntVar J,
                          KIntVar X,
                          int offset1,
                          int offset2)
        Primary Constructor
        Parameters:
        matrix - the values
        I - the first index variable
        J - the second index variable
        X - the value variable
        offset1 - constant offset of first index variable
        offset2 - constant offset of second index variable
      • KElement2D

        public KElement2D​(KEltTerm2D eltTerm2D,
                          KIntVar X,
                          java.lang.String name)
        Constructor with KEltTerm2D
        Parameters:
        eltTerm2D - the two dimensional element term
        X - the value variable
        name - name of the constraint
      • KElement2D

        public KElement2D​(KEltTerm2D eltTerm2D,
                          KIntVar X)
        Constructor with KEltTerm2D
        Parameters:
        eltTerm2D - the two dimensional element term
        X - the value variable
      • KElement2D

        public KElement2D​(KElement2D toCopy)
        Copy constructor
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KElement2D obj)
      • getValueForIndex

        public int getValueForIndex​(int index1,
                                    int index2)
        Get the value for I = index1 and J = index2
      • setUseValueFunction

        public void setUseValueFunction​(boolean useValueFunction)
        Choose value method between Table and method 'getValueForIndex'
      • getConstraintIPtr

        public com.artelys.kalis.SWIGTYPE_p_void getConstraintIPtr()