Domain Model
Build domain models with DomainModel, DomainClass, and FieldDescriptor
This section covers how to define your planning domain using SolverForge’s domain modeling API.
DomainModel, DomainClass, and FieldDescriptorPlanningAnnotation typesA domain model describes the structure of your planning problem:
use solverforge_core::domain::{
DomainClass, DomainModel, FieldDescriptor, FieldType,
PlanningAnnotation, PrimitiveType, ScoreType,
};
let model = DomainModel::builder()
.add_class(
DomainClass::new("Shift")
.with_annotation(PlanningAnnotation::PlanningEntity)
.with_field(/* ... */)
)
.add_class(
DomainClass::new("Schedule")
.with_annotation(PlanningAnnotation::PlanningSolution)
.with_field(/* ... */)
)
.build();
| Concept | Purpose | Annotation |
|---|---|---|
| Planning Entity | Object modified by solver | @PlanningEntity |
| Planning Variable | Field assigned by solver | @PlanningVariable |
| Planning Solution | Container for all data | @PlanningSolution |
| Problem Fact | Read-only data | (no annotation needed) |
| Value Range Provider | Source of variable values | @ValueRangeProvider |
Use build_validated() to catch configuration errors early:
let model = DomainModel::builder()
.add_class(/* ... */)
.build_validated()?; // Returns SolverForgeError on invalid model
Validation checks:
@PlanningSolution@PlanningEntity@PlanningVariable@PlanningScore fieldBuild domain models with DomainModel, DomainClass, and FieldDescriptor
Configure planning behavior with PlanningAnnotation types
Supported field types including primitives, objects, collections, and scores
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.