Class ObstacleObjectFrame

  • Direct Known Subclasses:
    ObstacleObject

    public class ObstacleObjectFrame
    extends InternalConstraint
    Version:
    4.7

    This version of the ObstacleObject internal constraint allows the use of multiple d-boxes per shape.

    TODO, description explaining how it works, what is it good for, etc...

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static BoxDisplay display  
      (package private) static boolean DISPLAY_FRAME  
      private SimpleArrayList<DBox> extendedHoles
      the collection of holes that are included in all possible shapes, enlarged to include the whole domain that can be covered for any feasible choice of the origin
      java.util.LinkedList<DBox> frame
      the frame is the area that is ensured to be covered by the obstacle, given the domain of its origin variables
      private int frameArea
      it computes the area/volume of the frame.
      private DBox frameBoundingBox
      It specifies the bounding box of the frame.
      (package private) Geost geost
      It specifies the geost constraint to which this internal constraint belongs to.
      (package private) GeostObject obstacle
      It specifies the geost objection which is the foundation of this obstacle constraint.
      (package private) int[] selectedDimensions
      The selected dimensions are sorted, they were sorted by NonOverlapping external constraint.
      (package private) int timeSizeMax  
      (package private) int timeSizeOrigin  
      (package private) boolean useTime
      It specifies if the time dimension is used within computation.
    • Constructor Summary

      Constructors 
      Constructor Description
      ObstacleObjectFrame​(Geost geost, GeostObject obstacle, int[] selectedDimensions)
      It creates an internal constraint to enforce non-overlapping relation with this obstacle object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int[] absInfeasible​(Geost.SweepDirection minlex)
      It provides the largest or smallest point contained in the forbidden area represented by this constraint.
      int cardInfeasible()
      It provides an approximation of the number of infeasible points enforced by this constraint only.
      java.lang.String checkInvariants()
      It checks that this constraint has consistent data structures.
      private void clearFrame()
      It creates the frame if it does not exist, and clears it if it does.
      java.util.Collection<Var> definingVariables()
      It provides a collection, possibly empty, of variables which define this constraint.
      DBox isFeasible​(Geost.SweepDirection min, LexicographicalOrder order, GeostObject o, int currentShape, int[] c)
      It determines whether the given point is a feasible origin of object o, considering this constraint only.
      boolean isSingleUse()
      In some cases, a constraint is used only once per sweep direction on a path from root to leaf in the search tree.
      boolean isStatic()
      It provides information about the constraint future.
      protected boolean timeOnlyCheck​(Geost.SweepDirection min, LexicographicalOrder order, GeostObject o, int currentShape, int[] c)  
      java.lang.String toString()  
      private void updateExtendedHoles()  
      void updateFrame()
      updates the frame given the current values of the object coordinate variables.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • geost

        final Geost geost
        It specifies the geost constraint to which this internal constraint belongs to.
      • obstacle

        final GeostObject obstacle
        It specifies the geost objection which is the foundation of this obstacle constraint.
      • frame

        public java.util.LinkedList<DBox> frame
        the frame is the area that is ensured to be covered by the obstacle, given the domain of its origin variables
      • frameBoundingBox

        private DBox frameBoundingBox
        It specifies the bounding box of the frame.
      • frameArea

        private int frameArea
        it computes the area/volume of the frame.
      • extendedHoles

        private SimpleArrayList<DBox> extendedHoles
        the collection of holes that are included in all possible shapes, enlarged to include the whole domain that can be covered for any feasible choice of the origin
      • selectedDimensions

        final int[] selectedDimensions
        The selected dimensions are sorted, they were sorted by NonOverlapping external constraint.
      • useTime

        final boolean useTime
        It specifies if the time dimension is used within computation.
      • timeSizeOrigin

        int timeSizeOrigin
      • timeSizeMax

        int timeSizeMax
    • Constructor Detail

      • ObstacleObjectFrame

        public ObstacleObjectFrame​(Geost geost,
                                   GeostObject obstacle,
                                   int[] selectedDimensions)
        It creates an internal constraint to enforce non-overlapping relation with this obstacle object.
        Parameters:
        geost - the geost constraint which this constraint is part of.
        obstacle - the obstacle object responsible for this internal constraint.
        selectedDimensions - the dimensions on which the constraint is applied
    • Method Detail

      • checkInvariants

        public java.lang.String checkInvariants()
        It checks that this constraint has consistent data structures.
        Returns:
        a string describing the consistency problem with data structures, null if no problem encountered.
      • clearFrame

        private void clearFrame()
        It creates the frame if it does not exist, and clears it if it does.
      • updateFrame

        public void updateFrame()
        updates the frame given the current values of the object coordinate variables. This method should be called whenever some of the coordinate variables of the associated object change.
      • updateExtendedHoles

        private void updateExtendedHoles()
      • absInfeasible

        public int[] absInfeasible​(Geost.SweepDirection minlex)
        Description copied from class: InternalConstraint
        It provides the largest or smallest point contained in the forbidden area represented by this constraint. This point must be larger or equal (resp. smaller or equal) to the lexicographically largest (resp. smallest) point included in the forbidden area, whatever the lexical order is.

        TODO, is this function potentially still useful? If not remove, if yes then adapt the description about event point series. What is it used now for? I will keep it as it may be used later on, but for sure the code implementing those functions is not tested much or requires some cleaning.

        This allows to build an event point series that stays consistent whatever the lexical order is, and whatever the object to place is (some shifting is applied to take the object's shape into account)

        The dimension of the point returned is k+1, where k is the object dimension. The last dimension is time.

        Specified by:
        absInfeasible in class InternalConstraint
        Parameters:
        minlex - defines whether the maximal or minimal point should be returned
        Returns:
        the infeasible point's coordinates. If constraint cannot generate outbox then it returns null.
      • cardInfeasible

        public int cardInfeasible()
        Description copied from class: InternalConstraint
        It provides an approximation of the number of infeasible points enforced by this constraint only. The information provided by this function cannot be accurate, since no object is passed as an argument, but some consistent approximation should exist. For instance, in the case of a forbidden area, the returned value can be the number of points included in the area.

        This information is used as a heuristic in the sweeping algorithm to decide which constraint to use, so that the constraints that cover the largest space are used first.

        Specified by:
        cardInfeasible in class InternalConstraint
        Returns:
        an approximation of the number of infeasible points enforced by this constraint only.
      • definingVariables

        public java.util.Collection<Var> definingVariables()
        Description copied from class: InternalConstraint
        It provides a collection, possibly empty, of variables which define this constraint. This information is used to build a reverse index that allows to update the absolute infeasible points of a constraint when a variable changes.
        Specified by:
        definingVariables in class InternalConstraint
        Returns:
        the collection containing variables that define that constraint.
      • isFeasible

        public DBox isFeasible​(Geost.SweepDirection min,
                               LexicographicalOrder order,
                               GeostObject o,
                               int currentShape,
                               int[] c)
        Description copied from class: InternalConstraint
        It determines whether the given point is a feasible origin of object o, considering this constraint only. If it is not, returns a DBox corresponding to the largest infeasible domain, considering a sweep which uses the given ordering.

        The boundaries of the forbidden area must have the following properties: the lower extremum has to be infeasible, but the upper extremum has to be feasible (with respect to this constraint only).

        The dimension of the DBox returned is k+1, where k is the object dimension. The last dimension is time.

        Specified by:
        isFeasible in class InternalConstraint
        Parameters:
        min - the direction of the sweep
        order - the order to be used
        o - the object the constraint is applied to
        currentShape - the shape id that is currently considered for o
        c - the current position of the sweep.
        Returns:
        a DBox representing the forbidden region
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isStatic

        public boolean isStatic()
        Description copied from class: InternalConstraint
        It provides information about the constraint future. If a constraint will always generate the same outboxes deeper in the tree, it should return false, so that jumps in the event point series can be done.

        TODO the description above suggests that it should be called isDynamic as it returns false if the constraint outboxes stay the same.

        (not taking placed object into account; i.e. absInfeasible will always return the same points)

        Specified by:
        isStatic in class InternalConstraint
        Returns:
        TODO, proper description after fixing the above todo.
      • isSingleUse

        public boolean isSingleUse()
        Description copied from class: InternalConstraint
        In some cases, a constraint is used only once per sweep direction on a path from root to leaf in the search tree. In that case, the constraint can be ignored if it was seen at some point.

        TODO, what is the example of such constraint?

        Use this function to provide the information to Geost.

        Specified by:
        isSingleUse in class InternalConstraint
        Returns:
        TODO. Is this function used at all? It seems that all implementations return false and nowhere in geost it is used.