Class ObstacleObject
- java.lang.Object
-
- org.jacop.constraints.geost.InternalConstraint
-
- org.jacop.constraints.geost.ObstacleObjectFrame
-
- org.jacop.constraints.geost.ObstacleObject
-
public class ObstacleObject extends ObstacleObjectFrame
- Version:
- 4.8
This version of the ObstacleObject internal constraint allows the use of multiple d-boxes per shape.
TODO, describe how it works and what is the idea behind this implementation?
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jacop.constraints.geost.InternalConstraint
InternalConstraint.Applicability
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
frameExists
It is a boolean switch which steers this constraint behavior.(package private) int[]
lowerAbsInsfeasible
(package private) SimpleArrayList<DBox>
preshiftedElems
It shifts boxes of the given shape as required by the frame.(package private) int
shapeId
It stores the information about the shape, so it does not always have to look for its value inside the domain of shape variable.(package private) int[]
upperAbsInsfeasible
-
Fields inherited from class org.jacop.constraints.geost.ObstacleObjectFrame
display, DISPLAY_FRAME, frame, geost, obstacle, selectedDimensions, timeSizeMax, timeSizeOrigin, useTime
-
Fields inherited from class org.jacop.constraints.geost.InternalConstraint
applicability, constraintListIndex
-
-
Constructor Summary
Constructors Constructor Description ObstacleObject(Geost geost, GeostObject obstacle, int[] selectedDimensions)
It constructs an internal constraint to constraint the objects not to overlap 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.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.java.lang.String
toString()
void
updateFrame()
updates the frame given the current values of the object coordinate variables.-
Methods inherited from class org.jacop.constraints.geost.ObstacleObjectFrame
definingVariables, timeOnlyCheck
-
-
-
-
Field Detail
-
preshiftedElems
final SimpleArrayList<DBox> preshiftedElems
It shifts boxes of the given shape as required by the frame. It recomputed always when frame is updated. It allows for faster execution in between frame updates.
-
lowerAbsInsfeasible
final int[] lowerAbsInsfeasible
-
upperAbsInsfeasible
final int[] upperAbsInsfeasible
-
frameExists
boolean frameExists
It is a boolean switch which steers this constraint behavior. It is set to true as soon as frame is not empty.
-
shapeId
int shapeId
It stores the information about the shape, so it does not always have to look for its value inside the domain of shape variable.
-
-
Constructor Detail
-
ObstacleObject
public ObstacleObject(Geost geost, GeostObject obstacle, int[] selectedDimensions)
It constructs an internal constraint to constraint the objects not to overlap with this obstacle object.- Parameters:
geost
- the constraint for which this internal constraint has been created.obstacle
- the obstacle object which is responsible for this constraint.selectedDimensions
- the dimensions on which the constraint is applicable.
-
-
Method Detail
-
checkInvariants
public java.lang.String checkInvariants()
Description copied from class:ObstacleObjectFrame
It checks that this constraint has consistent data structures.- Overrides:
checkInvariants
in classObstacleObjectFrame
- Returns:
- a string describing the consistency problem with data structures, null if no problem encountered.
-
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.
- Overrides:
absInfeasible
in classObstacleObjectFrame
- 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.
- Overrides:
cardInfeasible
in classObstacleObjectFrame
- Returns:
- an approximation of the number of infeasible points enforced by this constraint only.
-
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.
- Overrides:
isFeasible
in classObstacleObjectFrame
- 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classObstacleObjectFrame
-
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)
- Overrides:
isStatic
in classObstacleObjectFrame
- 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.
- Overrides:
isSingleUse
in classObstacleObjectFrame
- Returns:
- TODO. Is this function used at all? It seems that all implementations return false and nowhere in geost it is used.
-
updateFrame
public void updateFrame()
Description copied from class:ObstacleObjectFrame
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.- Overrides:
updateFrame
in classObstacleObjectFrame
-
-