Class KElement2D

java.lang.Object
com.artelys.kalis.KConstraint
com.artelys.kalis.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 Details

    • KElement2D

      protected KElement2D(long cPtr, boolean cMemoryOwn)
    • KElement2D

      public KElement2D(KIntMatrix matrix, KIntVar I, KIntVar J, KIntVar X, int offset1, int offset2, 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, 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 Details

    • getCPtr

      protected static long getCPtr(KElement2D obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class KConstraint
    • delete

      public void delete()
      Overrides:
      delete in class KConstraint
    • 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()