public interface ExternalConstraint
This interface defines the minimal functionality that is required by a constraint in order to be used by Geost as an external constraint.
External constraints are loosely coupled with Geost internals, in the sense that they are only required to be able to provide a representation usable by Geost.
The generation of internal constraints is done only once per search, implying that it is possible to do costly operations in order to generate these constraints.
Modifier and Type | Method and Description |
---|---|
boolean |
addPrunableObjects(GeostObject o,
SimpleHashSet<GeostObject> accumulator)
It adds to the accumulator collection the objects that are likely to be pruned if the given object
changes.
|
Collection<? extends InternalConstraint> |
genInternalConstraints(Geost geost)
It generates internal constraints which will be used by Geost's sweeping
algorithm.
|
Collection<? extends InternalConstraint> |
getObjectConstraints(GeostObject o)
It provides the collection of internal constraints that the given object has to satisfy.
|
GeostObject[] |
getObjectScope()
Provides the collection of objects that this constraint applies to
|
boolean |
isInternalConstraintApplicableTo(InternalConstraint ic,
GeostObject o)
Returns true if the external constraint generated the supplied internal constraint ic, and that ic
applies to object o.
|
void |
onObjectUpdate(GeostObject o)
Handler method called by the Geost kernel when the domain of the object changes.
|
Collection<? extends InternalConstraint> genInternalConstraints(Geost geost)
The generation of internal constraints is done only once per search, implying that it is possible to do costly operations in order to generate internal constraints. However, another implication of this one-time use is that the internal constraints generated have to remain valid during the whole search.
geost
- the geost kernel that will use the generated constraintCollection<? extends InternalConstraint> getObjectConstraints(GeostObject o)
This method is used by the kernel only once per object, at the beginning of the search, to collect the set of constraints to use for each object.
o
- the geost object that needs to be constrainedboolean addPrunableObjects(GeostObject o, SimpleHashSet<GeostObject> accumulator)
TODO, optimize all the code around this functionality, avoid situation when accumulator has all objects anyway and external constraints are continuously queried to add objects and keep adding objects which are already in the set.
o
- the object that was prunedaccumulator
- the set of objects to add the object tovoid onObjectUpdate(GeostObject o)
o
- the objectboolean isInternalConstraintApplicableTo(InternalConstraint ic, GeostObject o)
ic
- internal constraint being checkedo
- object to which internal constrain should apply toGeostObject[] getObjectScope()
Copyright © 2022. All rights reserved.