Annotation Interface PlanningListVariable
PlanningEntity class.
The type of the PlanningListVariable annotated bean property (or a field) must be List.
List variable
A planning entity's property annotated with @PlanningListVariable is referred to as a list variable.
The way solver optimizes a list variable is by adding, removing, or changing order of elements in the List object
held by the list variable.
Disjoint lists
Furthermore, the current implementation works under the assumption that the list variables of all entity instances are "disjoint lists":
- List means that the order of elements inside a list planning variable is significant.
- Disjoint means that any given pair of entities have no common elements in their list variables. In other words, each element from the list variable's value range appears in exactly one entity's list variable.
This makes sense for common use cases, for example the Vehicle Routing Problem or Task Assigning. In both cases the order in which customers are visited and tasks are being worked on matters. Also, each customer must be visited once and each task must be completed by exactly one employee.
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIf set to false (default), all elements must be assigned to some list.Class<? extends Comparator>Allows sorting a collection of planning values for this variable.Class<? extends ComparatorFactory>TheComparatorFactoryalternative forcomparatorClass().String[]
-
Element Details
-
allowsUnassignedValues
boolean allowsUnassignedValuesIf set to false (default), all elements must be assigned to some list. If set to true, elements may be left unassigned.- See Also:
- Default:
- false
-
valueRangeProviderRefs
String[] valueRangeProviderRefs- Default:
- {}
-
comparatorClass
Class<? extends Comparator> comparatorClassAllows sorting a collection of planning values for this variable. Some algorithms perform better when the values are sorted based on specific metrics.The
Comparatorshould sort the data in ascending order. For example, prioritize three visits by sorting them based on their importance: Visit C (SMALL_PRIORITY), Visit A (MEDIUM_PRIORITY), Visit B (HIGH_PRIORITY)Do not use together with
comparatorFactoryClass().- Returns:
PlanningVariable.NullComparatorwhen it is null (workaround for annotation limitation)- See Also:
- Default:
- ai.timefold.solver.core.api.domain.variable.PlanningVariable.NullComparator.class
-
comparatorFactoryClass
Class<? extends ComparatorFactory> comparatorFactoryClassTheComparatorFactoryalternative forcomparatorClass().Do not use together with
comparatorClass().- Returns:
PlanningVariable.NullComparatorFactorywhen it is null (workaround for annotation limitation)- See Also:
- Default:
- ai.timefold.solver.core.api.domain.variable.PlanningVariable.NullComparatorFactory.class
-