PlanningAnnotation

Enum PlanningAnnotation 

Source
pub enum PlanningAnnotation {
Show 21 variants PlanningId, PlanningEntity, PlanningSolution, PlanningVariable { value_range_provider_refs: Vec<String>, allows_unassigned: bool, }, PlanningListVariable { value_range_provider_refs: Vec<String>, allows_unassigned_values: bool, }, PlanningScore { bendable_hard_levels: Option<i32>, bendable_soft_levels: Option<i32>, }, ValueRangeProvider { id: Option<String>, }, ProblemFactProperty, ProblemFactCollectionProperty, PlanningEntityProperty, PlanningEntityCollectionProperty, PlanningPin, InverseRelationShadowVariable { source_variable_name: String, }, IndexShadowVariable { source_variable_name: String, }, NextElementShadowVariable { source_variable_name: String, }, PreviousElementShadowVariable { source_variable_name: String, }, AnchorShadowVariable { source_variable_name: String, }, CascadingUpdateShadowVariable { target_method_name: String, compute_expression: Option<Expression>, }, PiggybackShadowVariable { shadow_variable_name: String, }, DifficultyComparator { comparator_function: String, }, StrengthComparator { comparator_function: String, },
}
Expand description

Planning annotations for domain fields.

Matches Timefold annotations 1:1:

  • PlanningVariable: valueRangeProviderRefs[], allowsUnassigned
  • PlanningListVariable: valueRangeProviderRefs[], allowsUnassignedValues
  • ValueRangeProvider: id
  • PlanningScore: bendableHardLevelsSize, bendableSoftLevelsSize
  • InverseRelationShadowVariable: sourceVariableName

Serialization matches the Java solver service expectations exactly:

  • Tag: "annotation" (not "type")
  • Field names use camelCase

Variants§

§

PlanningId

Marks a field as the unique identifier for a planning entity.

§

PlanningEntity

Marks a class as a planning entity that the solver can change. Used at class level in DomainClass.

§

PlanningSolution

Marks a class as the planning solution containing entities and problem facts. Used at class level in DomainClass.

§

PlanningVariable

Marks a field as a planning variable that the solver assigns. Matches Timefold’s @PlanningVariable annotation.

Fields

§value_range_provider_refs: Vec<String>

References to ValueRangeProvider ids that provide values for this variable. If empty, auto-detection by type is used.

§allows_unassigned: bool

If true, null is a valid value (variable can be unassigned).

§

PlanningListVariable

Marks a field as a list planning variable for list-based assignment. Matches Timefold’s @PlanningListVariable annotation.

Fields

§value_range_provider_refs: Vec<String>

References to ValueRangeProvider ids that provide values for this variable. If empty, auto-detection by type is used.

§allows_unassigned_values: bool

If true, elements can remain unassigned (not in any list).

§

PlanningScore

Marks a field as the score of the solution. Matches Timefold’s @PlanningScore annotation.

Fields

§bendable_hard_levels: Option<i32>

Number of hard levels for bendable scores.

§bendable_soft_levels: Option<i32>

Number of soft levels for bendable scores.

§

ValueRangeProvider

Marks a collection as providing values for planning variables. Matches Timefold’s @ValueRangeProvider annotation.

Fields

§id: Option<String>

The id used by PlanningVariable.valueRangeProviderRefs to reference this provider. If empty, auto-detection by type is used.

§

ProblemFactProperty

Marks a field as a problem fact (immutable input data).

§

ProblemFactCollectionProperty

Marks a collection field as containing problem facts.

§

PlanningEntityProperty

Marks a field as containing a single planning entity.

§

PlanningEntityCollectionProperty

Marks a collection field as containing planning entities.

§

PlanningPin

Marks a field as pinned (solver won’t change it).

§

InverseRelationShadowVariable

Shadow variable that tracks the inverse of a list variable relationship. Matches Timefold’s @InverseRelationShadowVariable annotation.

Fields

§source_variable_name: String

The name of the source variable on the other side of the relationship.

§

IndexShadowVariable

Shadow variable that tracks the index position within a list variable. Matches Timefold’s @IndexShadowVariable annotation.

Fields

§source_variable_name: String

The name of the source list variable.

§

NextElementShadowVariable

Shadow variable that references the next element in a list variable. Matches Timefold’s @NextElementShadowVariable annotation.

Fields

§source_variable_name: String

The name of the source list variable.

§

PreviousElementShadowVariable

Shadow variable that references the previous element in a list variable. Matches Timefold’s @PreviousElementShadowVariable annotation.

Fields

§source_variable_name: String

The name of the source list variable.

§

AnchorShadowVariable

Shadow variable that tracks the anchor (starting entity) in a chained variable. Matches Timefold’s @AnchorShadowVariable annotation.

Fields

§source_variable_name: String

The name of the source chained variable.

§

CascadingUpdateShadowVariable

Shadow variable updated via cascading updates through a list. Matches Timefold’s @CascadingUpdateShadowVariable annotation.

Fields

§target_method_name: String

The method name to call for computing the value.

§compute_expression: Option<Expression>

Expression that computes the shadow variable value. Param(0) refers to the entity itself (the entity pointer). REQUIRED for WASM generation - build fails if None.

§

PiggybackShadowVariable

Shadow variable that piggybacks on another shadow variable’s updates. Matches Timefold’s @PiggybackShadowVariable annotation.

Fields

§shadow_variable_name: String

The name of the shadow variable to piggyback on.

§

DifficultyComparator

Comparator for ordering entities by difficulty during solving. Matches Timefold’s difficultyComparatorClass annotation.

Fields

§comparator_function: String

The function name that compares two entities by difficulty.

§

StrengthComparator

Comparator for ordering values by strength during solving. Matches Timefold’s strengthComparatorClass annotation.

Fields

§comparator_function: String

The function name that compares two values by strength.

Implementations§

Source§

impl PlanningAnnotation

Source

pub fn planning_id() -> Self

Creates a PlanningId annotation.

Source

pub fn planning_variable(value_range_provider_refs: Vec<String>) -> Self

Creates a PlanningVariable annotation with default settings.

Source

pub fn planning_variable_unassigned( value_range_provider_refs: Vec<String>, ) -> Self

Creates a PlanningVariable annotation that allows unassigned values.

Source

pub fn planning_variable_full( value_range_provider_refs: Vec<String>, allows_unassigned: bool, ) -> Self

Creates a PlanningVariable with full control over all fields.

Source

pub fn planning_list_variable(value_range_provider_refs: Vec<String>) -> Self

Creates a PlanningListVariable annotation with default settings.

Source

pub fn planning_list_variable_unassigned( value_range_provider_refs: Vec<String>, ) -> Self

Creates a PlanningListVariable annotation that allows unassigned values.

Source

pub fn planning_list_variable_full( value_range_provider_refs: Vec<String>, allows_unassigned_values: bool, ) -> Self

Creates a PlanningListVariable with full control over all fields.

Source

pub fn planning_score() -> Self

Creates a PlanningScore annotation for non-bendable scores.

Source

pub fn planning_score_bendable(hard_levels: i32, soft_levels: i32) -> Self

Creates a PlanningScore annotation for bendable scores.

Source

pub fn value_range_provider() -> Self

Creates a ValueRangeProvider annotation without an explicit id.

Source

pub fn value_range_provider_with_id(id: impl Into<String>) -> Self

Creates a ValueRangeProvider annotation with an explicit id.

Source

pub fn inverse_relation_shadow(source_variable_name: impl Into<String>) -> Self

Creates an InverseRelationShadowVariable annotation.

Source

pub fn index_shadow(source_variable_name: impl Into<String>) -> Self

Creates an IndexShadowVariable annotation.

Source

pub fn next_element_shadow(source_variable_name: impl Into<String>) -> Self

Creates a NextElementShadowVariable annotation.

Source

pub fn previous_element_shadow(source_variable_name: impl Into<String>) -> Self

Creates a PreviousElementShadowVariable annotation.

Source

pub fn anchor_shadow(source_variable_name: impl Into<String>) -> Self

Creates an AnchorShadowVariable annotation.

Source

pub fn cascading_update_shadow( target_method_name: impl Into<String>, compute_expression: Expression, ) -> Self

Creates a CascadingUpdateShadowVariable annotation with expression. Use this when you have the compute expression ready.

Source

pub fn cascading_update_shadow_pending( target_method_name: impl Into<String>, ) -> Self

Creates a CascadingUpdateShadowVariable annotation without expression. The expression MUST be set before WASM generation or build will fail. This is used by the derive macro; call set_cascading_expression on the DomainModel to provide the expression before building.

Source

pub fn piggyback_shadow(shadow_variable_name: impl Into<String>) -> Self

Creates a PiggybackShadowVariable annotation.

Source

pub fn difficulty_comparator(comparator_function: impl Into<String>) -> Self

Creates a DifficultyComparator annotation.

Source

pub fn strength_comparator(comparator_function: impl Into<String>) -> Self

Creates a StrengthComparator annotation.

Source

pub fn problem_fact_property() -> Self

Creates a ProblemFactProperty annotation.

Source

pub fn problem_fact_collection_property() -> Self

Creates a ProblemFactCollectionProperty annotation.

Source

pub fn planning_entity_property() -> Self

Creates a PlanningEntityProperty annotation.

Source

pub fn planning_entity_collection_property() -> Self

Creates a PlanningEntityCollectionProperty annotation.

Source

pub fn is_planning_variable(&self) -> bool

Returns true if this is a PlanningVariable annotation.

Source

pub fn is_planning_list_variable(&self) -> bool

Returns true if this is a PlanningListVariable annotation.

Source

pub fn is_any_variable(&self) -> bool

Returns true if this is any kind of planning variable (regular or list).

Source

pub fn is_shadow_variable(&self) -> bool

Returns true if this is a shadow variable annotation.

Source

pub fn value_range_provider_refs(&self) -> Option<&Vec<String>>

Returns the value_range_provider_refs if this is a planning variable.

Trait Implementations§

Source§

impl Clone for PlanningAnnotation

Source§

fn clone(&self) -> PlanningAnnotation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlanningAnnotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PlanningAnnotation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PlanningAnnotation

Source§

fn eq(&self, other: &PlanningAnnotation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PlanningAnnotation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PlanningAnnotation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,