Class Constraint

Direct Known Subclasses:
CastConstraint, DisjunctiveConstraint, GlobalVehicleBreaksConstraint, Pack, TypeRegulationsConstraint

public class Constraint extends PropagationBaseObject
A constraint is the main modeling object. It provides two methods:
- Post() is responsible for creating the demons and attaching them to
immediate demons().
- InitialPropagate() is called once just after Post and performs
the initial propagation. The subsequent propagations will be performed
by the demons Posted during the post() method.
  • Constructor Details

    • Constraint

      public Constraint(long cPtr, boolean cMemoryOwn)
  • Method Details

    • getCPtr

      public static long getCPtr(Constraint obj)
    • swigRelease

      public static long swigRelease(Constraint obj)
    • finalize

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

      public void delete()
      Overrides:
      delete in class PropagationBaseObject
    • post

      public void post()
      This method is called when the constraint is processed by the
      solver. Its main usage is to attach demons to variables.
    • initialPropagate

      public void initialPropagate()
      This method performs the initial propagation of the
      constraint. It is called just after the post.
    • toString

      public String toString()
      Overrides:
      toString in class PropagationBaseObject
    • postAndPropagate

      public void postAndPropagate()
      Calls Post and then Propagate to initialize the constraints. This
      is usually done in the root node.
    • accept

      public void accept(ModelVisitor visitor)
      Accepts the given visitor.
    • isCastConstraint

      public boolean isCastConstraint()
      Is the constraint created by a cast from expression to integer variable?
    • var

      public IntVar var()
      Creates a Boolean variable representing the status of the constraint
      (false = constraint is violated, true = constraint is satisfied). It
      returns nullptr if the constraint does not support this API.