public interface ConstraintStream
one, two
or more objects.
Constraint steams are similar to a declaration of a JDK Stream or an SQL query,
but they support incremental score calculation
and ScoreDirector.getConstraintMatchTotalMap() score justification}.
An object that passes through constraint streams is called a fact.
It's either a problem fact or a planning entity.
A constraint stream is typically created with ConstraintFactory.from(Class)
or UniConstraintStream.join(UniConstraintStream, BiJoiner) by joining another constraint stream}.
Constraint streams form a directed, non-cyclic graph, with multiple start nodes (which listen to fact changes)
and one end node per Constraint (which affect the Score).
| Modifier and Type | Method and Description |
|---|---|
ConstraintFactory |
getConstraintFactory()
The
ConstraintFactory that build this. |
default Constraint |
penalize(String constraintName,
Score<?> constraintWeight)
Negatively impact the
Score: subtract the constraintWeight for each match. |
Constraint |
penalize(String constraintPackage,
String constraintName,
Score<?> constraintWeight)
As defined by
penalize(String, Score). |
default Constraint |
penalizeConfigurable(String constraintName)
Negatively impact the
Score: subtract the ConstraintWeight for each match. |
Constraint |
penalizeConfigurable(String constraintPackage,
String constraintName)
As defined by
penalizeConfigurable(String). |
default Constraint |
reward(String constraintName,
Score<?> constraintWeight)
Positively impact the
Score: add the constraintWeight for each match. |
Constraint |
reward(String constraintPackage,
String constraintName,
Score<?> constraintWeight)
As defined by
reward(String, Score). |
default Constraint |
rewardConfigurable(String constraintName)
Positively impact the
Score: add the ConstraintWeight for each match. |
Constraint |
rewardConfigurable(String constraintPackage,
String constraintName)
As defined by
rewardConfigurable(String). |
ConstraintFactory getConstraintFactory()
ConstraintFactory that build this.default Constraint penalize(String constraintName, Score<?> constraintWeight)
Score: subtract the constraintWeight for each match.
To avoid hard-coding the constraintWeight, to allow end-users to weak it,
use penalizeConfigurable(String) and a ConstraintConfiguration instead.
The Constraint.getConstraintPackage() defaults to the package of the PlanningSolution class.
constraintName - never null, shows up in ConstraintMatchTotal during score justificationconstraintWeight - never nullConstraint penalize(String constraintPackage, String constraintName, Score<?> constraintWeight)
penalize(String, Score).constraintPackage - never nullconstraintName - never nullconstraintWeight - never nulldefault Constraint penalizeConfigurable(String constraintName)
Score: subtract the ConstraintWeight for each match.
The constraintWeight comes from an ConstraintWeight annotated member on the ConstraintConfiguration,
so end users can change the constraint weights dynamically.
This constraint is deactivated if the ConstraintWeight is zero.
If there is no ConstraintConfiguration, use penalize(String, Score) instead.
The Constraint.getConstraintPackage() defaults to ConstraintConfiguration.constraintPackage().
constraintName - never null, shows up in ConstraintMatchTotal during score justificationConstraint penalizeConfigurable(String constraintPackage, String constraintName)
penalizeConfigurable(String).constraintPackage - never nullconstraintName - never nulldefault Constraint reward(String constraintName, Score<?> constraintWeight)
Score: add the constraintWeight for each match.
To avoid hard-coding the constraintWeight, to allow end-users to weak it,
use penalizeConfigurable(String) and a ConstraintConfiguration instead.
The Constraint.getConstraintPackage() defaults to the package of the PlanningSolution class.
constraintName - never null, shows up in ConstraintMatchTotal during score justificationconstraintWeight - never nullConstraint reward(String constraintPackage, String constraintName, Score<?> constraintWeight)
reward(String, Score).constraintPackage - never nullconstraintName - never nullconstraintWeight - never nulldefault Constraint rewardConfigurable(String constraintName)
Score: add the ConstraintWeight for each match.
The constraintWeight comes from an ConstraintWeight annotated member on the ConstraintConfiguration,
so end users can change the constraint weights dynamically.
This constraint is deactivated if the ConstraintWeight is zero.
If there is no ConstraintConfiguration, use reward(String, Score) instead.
The Constraint.getConstraintPackage() defaults to ConstraintConfiguration.constraintPackage().
constraintName - never null, shows up in ConstraintMatchTotal during score justificationConstraint rewardConfigurable(String constraintPackage, String constraintName)
rewardConfigurable(String).constraintPackage - never nullconstraintName - never nullCopyright © 2006–2019 JBoss by Red Hat. All rights reserved.