Annotation Interface ValueRangeProvider


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface ValueRangeProvider
Provides the planning values that can be used for a PlanningVariable.

This is specified on a getter of a java bean property (or directly on a field) which returns a Collection or ValueRange. A Collection is implicitly converted to a ValueRange. For solver reproducibility, the collection must have a deterministic, stable iteration order. It is recommended to use a List, LinkedHashSet or SortedSet.

Value ranges are not allowed to contain null values. When PlanningVariable.allowsUnassigned() or PlanningListVariable.allowsUnassignedValues() is true, the solver will handle null values on its own.

Value ranges are not allowed to contain multiple copies of the same object, as defined by ==. It is recommended that the value range never contains two objects that are equal according to Object.equals(Object), but this is not enforced to not depend on user-defined Object.equals(Object) implementations. Having duplicates in a value range can lead to unexpected behavior, and skews selection probabilities in random selection algorithms.

Value ranges are not allowed to change during solving. This is especially important for value ranges defined on PlanningEntity-annotated classes; these must never depend on any of that entity's variables, or on any other entity's variables. If you need to change a value range defined on an entity, trigger a ProblemChange for that entity or restart the solver with an updated planning solution. If you need to change a value range defined on a planning solution, restart the solver with a new planning solution.