Interface InnerConstraintFactory<Solution_>
-
- All Superinterfaces:
ConstraintFactory
- All Known Implementing Classes:
BavetConstraintFactory,DroolsConstraintFactory
public interface InnerConstraintFactory<Solution_> extends ConstraintFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ConstraintSessionFactory<Solution_>buildSessionFactory(Constraint[] constraints)This method is thread-safe.default <A> UniConstraintStream<A>from(Class<A> fromClass)Start aConstraintStreamof all instances of the fromClass that are known asproblem factsorplanning entities.default <A> BiConstraintStream<A,A>fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner)Create a newBiConstraintStreamfor every unique combination of A and another A with a higherPlanningIdfor which theBiJoineris true (for the properties it extracts from both facts).SolutionDescriptor<Solution_>getSolutionDescriptor()-
Methods inherited from interface org.optaplanner.core.api.score.stream.ConstraintFactory
fromUnfiltered, fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair, getDefaultConstraintPackage
-
-
-
-
Method Detail
-
from
default <A> UniConstraintStream<A> from(Class<A> fromClass)
Description copied from interface:ConstraintFactoryStart aConstraintStreamof all instances of the fromClass that are known asproblem factsorplanning entities.If the fromClass is a
PlanningEntity, then it will be automaticallyfilteredto only contain fully initialized entities, for which each genuinePlanningVariable(of the fromClass or a superclass thereof) is initialized (so when the value is not null - unlessPlanningVariable.nullable()is modified). This filtering will NOT automatically apply to genuine planning variables of subclass planning entities of the fromClass.- Specified by:
fromin interfaceConstraintFactory- Type Parameters:
A- the type of the matched problem fact orplanning entity- Parameters:
fromClass- never null- Returns:
- never null
-
fromUniquePair
default <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner)
Description copied from interface:ConstraintFactoryCreate a newBiConstraintStreamfor every unique combination of A and another A with a higherPlanningIdfor which theBiJoineris true (for the properties it extracts from both facts).Important: This is faster and more scalable than not using a
ConstraintFactory.fromUniquePair(Class)joiner} followed by afilter, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks almost every combination of A and A.This method is syntactic sugar for
UniConstraintStream.join(Class, BiJoiner). It automatically adds alessThanjoiner on thePlanningIdof A.This method has overloaded methods with multiple
BiJoinerparameters.- Specified by:
fromUniquePairin interfaceConstraintFactory- Type Parameters:
A- the type of the matched problem fact orplanning entity- Parameters:
fromClass- never nulljoiner- never null- Returns:
- a stream that matches every unique combination of A and another A for which the
BiJoineris true
-
buildSessionFactory
ConstraintSessionFactory<Solution_> buildSessionFactory(Constraint[] constraints)
This method is thread-safe.- Parameters:
constraints- never null- Returns:
- never null
-
getSolutionDescriptor
SolutionDescriptor<Solution_> getSolutionDescriptor()
- Returns:
- never null
-
-