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
PlanningListVariable
Marks a field as a list planning variable for list-based assignment. Matches Timefold’s @PlanningListVariable annotation.
Fields
PlanningScore
Marks a field as the score of the solution. Matches Timefold’s @PlanningScore annotation.
Fields
ValueRangeProvider
Marks a collection as providing values for planning variables. Matches Timefold’s @ValueRangeProvider annotation.
Fields
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
IndexShadowVariable
Shadow variable that tracks the index position within a list variable. Matches Timefold’s @IndexShadowVariable annotation.
NextElementShadowVariable
Shadow variable that references the next element in a list variable. Matches Timefold’s @NextElementShadowVariable annotation.
PreviousElementShadowVariable
Shadow variable that references the previous element in a list variable. Matches Timefold’s @PreviousElementShadowVariable annotation.
AnchorShadowVariable
Shadow variable that tracks the anchor (starting entity) in a chained variable. Matches Timefold’s @AnchorShadowVariable annotation.
CascadingUpdateShadowVariable
Shadow variable updated via cascading updates through a list. Matches Timefold’s @CascadingUpdateShadowVariable annotation.
Fields
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.
DifficultyComparator
Comparator for ordering entities by difficulty during solving. Matches Timefold’s difficultyComparatorClass annotation.
StrengthComparator
Comparator for ordering values by strength during solving. Matches Timefold’s strengthComparatorClass annotation.
Implementations§
Source§impl PlanningAnnotation
impl PlanningAnnotation
Sourcepub fn planning_id() -> Self
pub fn planning_id() -> Self
Creates a PlanningId annotation.
Sourcepub fn planning_variable(value_range_provider_refs: Vec<String>) -> Self
pub fn planning_variable(value_range_provider_refs: Vec<String>) -> Self
Creates a PlanningVariable annotation with default settings.
Sourcepub fn planning_variable_unassigned(
value_range_provider_refs: Vec<String>,
) -> Self
pub fn planning_variable_unassigned( value_range_provider_refs: Vec<String>, ) -> Self
Creates a PlanningVariable annotation that allows unassigned values.
Sourcepub fn planning_variable_full(
value_range_provider_refs: Vec<String>,
allows_unassigned: bool,
) -> Self
pub fn planning_variable_full( value_range_provider_refs: Vec<String>, allows_unassigned: bool, ) -> Self
Creates a PlanningVariable with full control over all fields.
Sourcepub fn planning_list_variable(value_range_provider_refs: Vec<String>) -> Self
pub fn planning_list_variable(value_range_provider_refs: Vec<String>) -> Self
Creates a PlanningListVariable annotation with default settings.
Sourcepub fn planning_list_variable_unassigned(
value_range_provider_refs: Vec<String>,
) -> Self
pub fn planning_list_variable_unassigned( value_range_provider_refs: Vec<String>, ) -> Self
Creates a PlanningListVariable annotation that allows unassigned values.
Sourcepub fn planning_list_variable_full(
value_range_provider_refs: Vec<String>,
allows_unassigned_values: bool,
) -> Self
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.
Sourcepub fn planning_score() -> Self
pub fn planning_score() -> Self
Creates a PlanningScore annotation for non-bendable scores.
Sourcepub fn planning_score_bendable(hard_levels: i32, soft_levels: i32) -> Self
pub fn planning_score_bendable(hard_levels: i32, soft_levels: i32) -> Self
Creates a PlanningScore annotation for bendable scores.
Sourcepub fn value_range_provider() -> Self
pub fn value_range_provider() -> Self
Creates a ValueRangeProvider annotation without an explicit id.
Sourcepub fn value_range_provider_with_id(id: impl Into<String>) -> Self
pub fn value_range_provider_with_id(id: impl Into<String>) -> Self
Creates a ValueRangeProvider annotation with an explicit id.
Sourcepub fn inverse_relation_shadow(source_variable_name: impl Into<String>) -> Self
pub fn inverse_relation_shadow(source_variable_name: impl Into<String>) -> Self
Creates an InverseRelationShadowVariable annotation.
Sourcepub fn index_shadow(source_variable_name: impl Into<String>) -> Self
pub fn index_shadow(source_variable_name: impl Into<String>) -> Self
Creates an IndexShadowVariable annotation.
Sourcepub fn next_element_shadow(source_variable_name: impl Into<String>) -> Self
pub fn next_element_shadow(source_variable_name: impl Into<String>) -> Self
Creates a NextElementShadowVariable annotation.
Sourcepub fn previous_element_shadow(source_variable_name: impl Into<String>) -> Self
pub fn previous_element_shadow(source_variable_name: impl Into<String>) -> Self
Creates a PreviousElementShadowVariable annotation.
Sourcepub fn anchor_shadow(source_variable_name: impl Into<String>) -> Self
pub fn anchor_shadow(source_variable_name: impl Into<String>) -> Self
Creates an AnchorShadowVariable annotation.
Sourcepub fn cascading_update_shadow(
target_method_name: impl Into<String>,
compute_expression: Expression,
) -> Self
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.
Sourcepub fn cascading_update_shadow_pending(
target_method_name: impl Into<String>,
) -> Self
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.
Sourcepub fn piggyback_shadow(shadow_variable_name: impl Into<String>) -> Self
pub fn piggyback_shadow(shadow_variable_name: impl Into<String>) -> Self
Creates a PiggybackShadowVariable annotation.
Sourcepub fn difficulty_comparator(comparator_function: impl Into<String>) -> Self
pub fn difficulty_comparator(comparator_function: impl Into<String>) -> Self
Creates a DifficultyComparator annotation.
Sourcepub fn strength_comparator(comparator_function: impl Into<String>) -> Self
pub fn strength_comparator(comparator_function: impl Into<String>) -> Self
Creates a StrengthComparator annotation.
Sourcepub fn problem_fact_property() -> Self
pub fn problem_fact_property() -> Self
Creates a ProblemFactProperty annotation.
Sourcepub fn problem_fact_collection_property() -> Self
pub fn problem_fact_collection_property() -> Self
Creates a ProblemFactCollectionProperty annotation.
Sourcepub fn planning_entity_property() -> Self
pub fn planning_entity_property() -> Self
Creates a PlanningEntityProperty annotation.
Sourcepub fn planning_entity_collection_property() -> Self
pub fn planning_entity_collection_property() -> Self
Creates a PlanningEntityCollectionProperty annotation.
Sourcepub fn is_planning_variable(&self) -> bool
pub fn is_planning_variable(&self) -> bool
Returns true if this is a PlanningVariable annotation.
Sourcepub fn is_planning_list_variable(&self) -> bool
pub fn is_planning_list_variable(&self) -> bool
Returns true if this is a PlanningListVariable annotation.
Sourcepub fn is_any_variable(&self) -> bool
pub fn is_any_variable(&self) -> bool
Returns true if this is any kind of planning variable (regular or list).
Sourcepub fn is_shadow_variable(&self) -> bool
pub fn is_shadow_variable(&self) -> bool
Returns true if this is a shadow variable annotation.
Sourcepub fn value_range_provider_refs(&self) -> Option<&Vec<String>>
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
impl Clone for PlanningAnnotation
Source§fn clone(&self) -> PlanningAnnotation
fn clone(&self) -> PlanningAnnotation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more