Class InternalConstraint
- Direct Known Subclasses:
AllowedArea
,DomainHoles
,ForbiddenArea
,ObstacleObjectFrame
- Version:
- 4.9
This interface defines the functionality required by a constraint in order to be used by Geost's sweeping algorithm.
The different methods defined by this interface are likely to be called often during a single call to the consistency function, and should therefore be as efficient as possible.
Comments about implementation details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
In order to avoid the cost of repeated calls to isInternalConstraintApplicable, we need 3 different states. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) InternalConstraint.Applicability
the current applicability of the constraint.(package private) int
The ordering of constraints requires to maintain a reverse mapping. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int[]
absInfeasible
(Geost.SweepDirection minlex) It provides the largest or smallest point contained in the forbidden area represented by this constraint.abstract int
It provides an approximation of the number of infeasible points enforced by this constraint only.abstract Collection
<Var> It provides a collection, possibly empty, of variables which define this constraint.abstract 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.abstract boolean
In some cases, a constraint is used only once per sweep direction on a path from root to leaf in the search tree.abstract boolean
isStatic()
It provides information about the constraint future.
-
Field Details
-
constraintListIndex
int constraintListIndexThe ordering of constraints requires to maintain a reverse mapping. -
applicability
InternalConstraint.Applicability applicabilitythe current applicability of the constraint.
-
-
Constructor Details
-
InternalConstraint
public InternalConstraint()
-
-
Method Details
-
absInfeasible
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.
- 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.
-
isStatic
public abstract boolean isStatic()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)
- Returns:
- TODO, proper description after fixing the above todo.
-
isSingleUse
public abstract 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. 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.
- Returns:
- TODO. Is this function used at all? It seems that all implementations return false and nowhere in geost it is used.
-
isFeasible
public abstract 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. 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.
- Parameters:
min
- the direction of the sweeporder
- the order to be usedo
- the object the constraint is applied tocurrentShape
- the shape id that is currently considered for oc
- the current position of the sweep.- Returns:
- a DBox representing the forbidden region
-
cardInfeasible
public abstract int cardInfeasible()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.
- Returns:
- an approximation of the number of infeasible points enforced by this constraint only.
-
definingVariables
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.- Returns:
- the collection containing variables that define that constraint.
-