pub struct SolutionDescriptor {
pub type_name: &'static str,
pub type_id: TypeId,
pub entity_descriptors: Vec<EntityDescriptor>,
pub problem_fact_descriptors: Vec<ProblemFactDescriptor>,
pub score_field: &'static str,
pub score_is_optional: bool,
/* private fields */
}Expand description
Describes a planning solution at runtime.
Contains metadata about:
- Entity types and their descriptors
- Problem fact types
- Score type
Fields§
§type_name: &'static strName of the solution type.
type_id: TypeIdTypeId of the solution type.
entity_descriptors: Vec<EntityDescriptor>Descriptors for all entity types in this solution.
problem_fact_descriptors: Vec<ProblemFactDescriptor>Descriptors for all problem fact types.
score_field: &'static strName of the score field.
score_is_optional: boolWhether the score type is Option
Implementations§
Source§impl SolutionDescriptor
impl SolutionDescriptor
Sourcepub fn with_entity(self, descriptor: EntityDescriptor) -> Self
pub fn with_entity(self, descriptor: EntityDescriptor) -> Self
Adds an entity descriptor and indexes it by TypeId for O(1) lookup.
Sourcepub fn with_problem_fact(self, descriptor: ProblemFactDescriptor) -> Self
pub fn with_problem_fact(self, descriptor: ProblemFactDescriptor) -> Self
Adds a problem fact descriptor.
Sourcepub fn with_score_field(self, field: &'static str) -> Self
pub fn with_score_field(self, field: &'static str) -> Self
Sets the score field name.
Sourcepub fn find_entity_descriptor(
&self,
type_name: &str,
) -> Option<&EntityDescriptor>
pub fn find_entity_descriptor( &self, type_name: &str, ) -> Option<&EntityDescriptor>
Finds an entity descriptor by type name.
Sourcepub fn find_entity_descriptor_by_type(
&self,
type_id: TypeId,
) -> Option<&EntityDescriptor>
pub fn find_entity_descriptor_by_type( &self, type_id: TypeId, ) -> Option<&EntityDescriptor>
Finds an entity descriptor by type ID (O(1) lookup).
Sourcepub fn genuine_variable_descriptors(&self) -> Vec<&VariableDescriptor>
pub fn genuine_variable_descriptors(&self) -> Vec<&VariableDescriptor>
Returns all genuine variable descriptors across all entities.
Sourcepub fn shadow_variable_descriptors(&self) -> Vec<&VariableDescriptor>
pub fn shadow_variable_descriptors(&self) -> Vec<&VariableDescriptor>
Returns all shadow variable descriptors across all entities.
Sourcepub fn total_entity_count(&self, solution: &dyn Any) -> Option<usize>
pub fn total_entity_count(&self, solution: &dyn Any) -> Option<usize>
Returns the total number of entities across all entity collections.
Returns None if any entity descriptor lacks an extractor or the solution
type doesn’t match.
Sourcepub fn all_entity_refs(&self, solution: &dyn Any) -> Vec<(usize, EntityRef)>
pub fn all_entity_refs(&self, solution: &dyn Any) -> Vec<(usize, EntityRef)>
Returns all entity references across all entity collections.
Sourcepub fn for_each_entity<F>(&self, solution: &dyn Any, f: F)
pub fn for_each_entity<F>(&self, solution: &dyn Any, f: F)
Iterates over all entities in all collections.
The callback receives:
- The entity descriptor index
- The entity index within its collection
- A reference to the entity
Sourcepub fn get_entity<'a>(
&self,
solution: &'a dyn Any,
descriptor_index: usize,
entity_index: usize,
) -> Option<&'a dyn Any>
pub fn get_entity<'a>( &self, solution: &'a dyn Any, descriptor_index: usize, entity_index: usize, ) -> Option<&'a dyn Any>
Gets an entity by descriptor index and entity index.
Sourcepub fn get_entity_mut<'a>(
&self,
solution: &'a mut dyn Any,
descriptor_index: usize,
entity_index: usize,
) -> Option<&'a mut dyn Any>
pub fn get_entity_mut<'a>( &self, solution: &'a mut dyn Any, descriptor_index: usize, entity_index: usize, ) -> Option<&'a mut dyn Any>
Gets a mutable entity by descriptor index and entity index.
Sourcepub fn entity_descriptor_count(&self) -> usize
pub fn entity_descriptor_count(&self) -> usize
Returns the number of entity descriptors.
Sourcepub fn problem_fact_descriptor_count(&self) -> usize
pub fn problem_fact_descriptor_count(&self) -> usize
Returns the number of problem fact descriptors.
Sourcepub fn all_extractors_configured(&self) -> bool
pub fn all_extractors_configured(&self) -> bool
Returns whether all entity descriptors have extractors configured.