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
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
Sets the URL of the solver service.
Sourcepub fn with_termination(self, termination: TerminationConfig) -> Self
pub fn with_termination(self, termination: TerminationConfig) -> Self
Sets the termination configuration.
Sourcepub fn with_environment_mode(self, mode: EnvironmentMode) -> Self
pub fn with_environment_mode(self, mode: EnvironmentMode) -> Self
Sets the environment mode for the solver.
Sourcepub fn with_random_seed(self, seed: u64) -> Self
pub fn with_random_seed(self, seed: u64) -> Self
Sets the random seed for reproducible solving.
Sourcepub fn with_move_thread_count(self, count: MoveThreadCount) -> Self
pub fn with_move_thread_count(self, count: MoveThreadCount) -> Self
Sets the move thread count for parallel solving.
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>>
Builds a TypedSolver that can solve instances of the solution type.
§Errors
Returns an error if WASM module generation fails.
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.