Interface ValueRangeDescriptor<Solution_>

Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
All Known Implementing Classes:
AbstractFromPropertyValueRangeDescriptor, AbstractValueRangeDescriptor, CompositeValueRangeDescriptor, FromEntityPropertyValueRangeDescriptor, FromSolutionPropertyValueRangeDescriptor

@NullMarked public sealed interface ValueRangeDescriptor<Solution_> permits AbstractValueRangeDescriptor<Solution_>
  • Method Details

    • getOrdinal

      int getOrdinal()
      A number unique within a SolutionDescriptor, increasing sequentially from zero. Used for indexing in arrays to avoid object hash lookups in maps.
      Returns:
      zero or higher
    • getVariableDescriptor

      GenuineVariableDescriptor<Solution_> getVariableDescriptor()
      Returns:
      never null
    • acceptsNullInValueRange

      default boolean acceptsNullInValueRange()
      True when PlanningVariable.allowsUnassigned(). Always false with PlanningListVariable as list variables get unassigned through a different mechanism (e.g. ElementPositionRandomIterator).
    • isGenericTypeImmutable

      boolean isGenericTypeImmutable()
      Returns:
      true if the value range generic type is immutable.
    • isCountable

      boolean isCountable()
      Returns:
      true if the ValueRange is countable (for example a double value range between 1.2 and 1.4 is not countable)
    • canExtractValueRangeFromSolution

      boolean canExtractValueRangeFromSolution()
      Returns true if the value range is defined at the solution level and can be directly extracted from the solution; otherwise, it returns false, as the value range can only be extracted or computed from the entities.
    • mightContainEntity

      boolean mightContainEntity()
      Returns:
      true if the ValueRange might contain a planning entity instance (not necessarily of the same entity class as this entity class of this descriptor.
    • extractAllValues

      <T> ValueRange<T> extractAllValues(Solution_ solution)
      Extracts the ValueRange from the solution or, if the value range is defined at the entity level, extracts a composite ValueRange from all entities in the solution.

      The method should not be invoked directly by selectors or other components of the solver. The ValueRangeManager.getFromSolution(ValueRangeDescriptor, Object) and ValueRangeManager.getFromEntity(ValueRangeDescriptor, Object) serve as the single source of truth for managing value ranges and should be used by outer components.

      Calling this method outside ValueRangeManager may lead to unnecessary recomputation of ranges.

    • extractValuesFromEntity

      <T> ValueRange<T> extractValuesFromEntity(Solution_ solution, Object entity)
      Extracts the ValueRange from the planning entity. If the value range is defined at the solution level instead, this method reads the value range from there.

      The method should not be invoked directly by selectors or other components of the solver. The ValueRangeManager.getFromSolution(ValueRangeDescriptor, Object) and ValueRangeManager.getFromEntity(ValueRangeDescriptor, Object) serve as the single source of truth for managing value ranges and should be used by outer components.

      Calling this method outside ValueRangeManager may lead to unnecessary recomputation of ranges.