Annotation Interface PlanningVariable
Specifies that a bean property (or a field) can be changed and should be optimized by the optimization algorithms.
It is specified on a getter of a java bean property (or directly on a field) of a PlanningEntity
class.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Workaround for annotation limitation instrengthComparatorClass()
.static interface
Workaround for annotation limitation instrengthWeightFactoryClass()
. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionIn some use cases, such as Vehicle Routing, planning entities form a specific graph type, as specified byPlanningVariableGraphType
.boolean
A nullable planning variable will automatically add the planning value null to theValueRangeProvider
's range.Class<? extends Comparator>
Allows a collection of planning values for this variable to be sorted by strength.Class<? extends SelectionSorterWeightFactory>
TheSelectionSorterWeightFactory
alternative forstrengthComparatorClass()
.String[]
AnyValueRangeProvider
annotation on aPlanningSolution
orPlanningEntity
will automatically be registered with itsValueRangeProvider.id()
.
-
Element Details
-
valueRangeProviderRefs
String[] valueRangeProviderRefsAnyValueRangeProvider
annotation on aPlanningSolution
orPlanningEntity
will automatically be registered with itsValueRangeProvider.id()
.If no refs are provided, all
ValueRangeProvider
s without an id will be registered, provided their return types match the type of this variable.- Returns:
- 0 or more registered
ValueRangeProvider.id()
- Default:
- {}
-
nullable
boolean nullableA nullable planning variable will automatically add the planning value null to theValueRangeProvider
's range.Nullable true is not compatible with
PlanningVariableGraphType.CHAINED
true. Nullable true is not compatible with a primitive property type.- Returns:
- true if null is a valid value for this planning variable
- Default:
- false
-
graphType
PlanningVariableGraphType graphTypeIn some use cases, such as Vehicle Routing, planning entities form a specific graph type, as specified byPlanningVariableGraphType
.- Returns:
- never null, defaults to
PlanningVariableGraphType.NONE
- Default:
- NONE
-
strengthComparatorClass
Class<? extends Comparator> strengthComparatorClassAllows a collection of planning values for this variable to be sorted by strength. A strengthWeight estimates how strong a planning value is. Some algorithms benefit from planning on weaker planning values first or from focusing on them.The
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()
.- Returns:
PlanningVariable.NullStrengthComparator
when it is null (workaround for annotation limitation)- See Also:
- Default:
- org.optaplanner.core.api.domain.variable.PlanningVariable.NullStrengthComparator.class
-
strengthWeightFactoryClass
Class<? extends SelectionSorterWeightFactory> strengthWeightFactoryClassTheSelectionSorterWeightFactory
alternative forstrengthComparatorClass()
.Do not use together with
strengthComparatorClass()
.- Returns:
PlanningVariable.NullStrengthWeightFactory
when it is null (workaround for annotation limitation)- See Also:
- Default:
- org.optaplanner.core.api.domain.variable.PlanningVariable.NullStrengthWeightFactory.class
-