pub struct SolverBuilder<S: PlanningSolution> { /* private fields */ }Expand description
Builder for creating solvers from PlanningSolution types.
This builder automatically extracts domain models and constraints from the solution type and generates the required WASM module.
§Type Parameters
S: The solution type that implementsPlanningSolution
§Example
let solver = SolverBuilder::<Timetable>::new()
.with_termination(TerminationConfig::new().with_spent_limit("PT5M"))
.build()?;Implementations§
Source§impl<S: PlanningSolution> SolverBuilder<S>
impl<S: PlanningSolution> SolverBuilder<S>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SolverBuilder with default settings.
The default service URL is http://localhost:8080.
Sourcepub fn with_service_url(self, url: impl Into<String>) -> Self
pub fn with_service_url(self, url: impl Into<String>) -> Self
Sourcepub fn with_termination(self, termination: TerminationConfig) -> Self
pub fn with_termination(self, termination: TerminationConfig) -> Self
Sourcepub fn with_environment_mode(self, mode: EnvironmentMode) -> Self
pub fn with_environment_mode(self, mode: EnvironmentMode) -> Self
Sourcepub fn with_random_seed(self, seed: u64) -> Self
pub fn with_random_seed(self, seed: u64) -> Self
Sourcepub fn with_move_thread_count(self, count: MoveThreadCount) -> Self
pub fn with_move_thread_count(self, count: MoveThreadCount) -> Self
Sourcepub fn with_service(self, service: Arc<dyn SolverService>) -> Self
pub fn with_service(self, service: Arc<dyn SolverService>) -> Self
Uses a custom solver service instead of the default HTTP service.
This is useful for testing or when using a different transport.
Sourcepub fn domain_model() -> DomainModel
pub fn domain_model() -> DomainModel
Returns the domain model for the solution type.
This is extracted from the PlanningSolution::domain_model() method.
Sourcepub fn constraints() -> ConstraintSet
pub fn constraints() -> ConstraintSet
Returns the constraint set for the solution type.
This is extracted from the PlanningSolution::constraints() method.
Sourcepub fn build<B: LanguageBridge>(self) -> SolverForgeResult<TypedSolver<S, B>>
pub fn build<B: LanguageBridge>(self) -> SolverForgeResult<TypedSolver<S, B>>
Sourcepub fn build_with_bridge<B: LanguageBridge>(
self,
_bridge: Arc<B>,
) -> SolverForgeResult<TypedSolver<S, B>>
pub fn build_with_bridge<B: LanguageBridge>( self, _bridge: Arc<B>, ) -> SolverForgeResult<TypedSolver<S, B>>
Builds a TypedSolver with a specific bridge instance.
This is a convenience method that creates a solver ready to use with the provided bridge.