|
OptaPlanner core 6.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value=METHOD) @Retention(value=RUNTIME) public @interface PlanningVariable
Specifies that a bean property can be changed and should be optimized by the optimization algorithms.
It is specified on a getter of a java bean property of aPlanningEntity
class.
Optional Element Summary | |
---|---|
boolean |
chained
In some use cases, such as Vehicle Routing, planning entities are chained. |
String |
mappedBy
In a bidirectional relationship, the shadow side (= the slave side) uses this mappedBy() property
(and nothing else) to declare for which normal PlanningVariable (= the master side) it is a shadow. |
boolean |
nullable
A nullable planning variable will automatically add the planning value null to the ValueRange . |
Class<? extends SelectionFilter> |
reinitializeVariableEntityFilter
Construction heuristics only change reinitializable planning variables. |
Class<? extends Comparator> |
strengthComparatorClass
Allows a collection of planning values for this variable to be sorted by strength. |
Class<? extends SelectionSorterWeightFactory> |
strengthWeightFactoryClass
The SelectionSorterWeightFactory alternative for strengthComparatorClass() . |
Class<? extends PlanningVariableListener>[] |
variableListenerClasses
A PlanningVariableListener gets notified before and after a planning variable has changed. |
public abstract String mappedBy
mappedBy()
property
(and nothing else) to declare for which normal PlanningVariable
(= the master side) it is a shadow.
Both sides of a bidirectional relationship should be consistent: if A points to B then B must point to A.
When planner changes a normal variable, it adjusts the shadow variable accordingly.
In practice, planner ignores the shadow variables (except for consistency housekeeping).
public abstract boolean nullable
ValueRange
.
In repeated planning use cases, it's recommended to specify a reinitializeVariableEntityFilter()
for every nullable planning variable too.
nullable()
true is not compatible with {#link #chained} true.
nullable()
true is not compatible with a primitive property type.
public abstract Class<? extends SelectionFilter> reinitializeVariableEntityFilter
reinitializeVariableEntityFilter()
is specified,
the default considers an entity uninitialized for a variable if its value is null
(even if nullable()
is true).
The method SelectionFilter.accept(ScoreDirector, Object)
returns false if the selection entity should be reinitialized for this variable
and it returns true if the selection entity should not be reinitialized for this variable
PlanningVariable.NullReinitializeVariableEntityFilter
when it is null (workaround for annotation limitation)public abstract Class<? extends Comparator> strengthComparatorClass
Comparator
should sort in ascending strength.
For example: sorting 3 computers on strength based on their RAM capacity:
Computer B (1GB RAM), Computer A (2GB RAM), Computer C (7GB RAM),
Do not use together with strengthWeightFactoryClass()
.
PlanningVariable.NullStrengthComparator
when it is null (workaround for annotation limitation)strengthWeightFactoryClass()
public abstract Class<? extends SelectionSorterWeightFactory> strengthWeightFactoryClass
SelectionSorterWeightFactory
alternative for strengthComparatorClass()
.
Do not use together with strengthComparatorClass()
.
PlanningVariable.NullStrengthWeightFactory
when it is null (workaround for annotation limitation)strengthComparatorClass()
public abstract boolean chained
nullable()
true is not compatible with {#link #chained} true.
public abstract Class<? extends PlanningVariableListener>[] variableListenerClasses
PlanningVariableListener
gets notified before and after a planning variable has changed.
That listener changes shadow variables (often on other planning entities) accordingly,
Those shadow variables can make the score calculation more natural to write.
For example: VRP with time windows uses a PlanningVariableListener
to update the arrival times
of all the trailing entities when an entity is changed.
|
OptaPlanner core 6.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |