Expand description
SolverForge - Constraint solver library powered by Timefold
SolverForge is a Rust-based constraint solver library that uses WASM modules and HTTP communication to solve constraint satisfaction and optimization problems.
§Quick Start
ⓘ
use solverforge::prelude::*;
#[derive(PlanningEntity, Clone)]
struct Shift {
#[planning_id]
id: i64,
#[planning_variable(value_range_provider = "employees")]
employee: Option<Employee>,
}
#[derive(PlanningSolution, Clone)]
struct Schedule {
#[problem_fact_collection]
#[value_range_provider(id = "employees")]
employees: Vec<Employee>,
#[planning_entity_collection]
shifts: Vec<Shift>,
#[planning_score]
score: Option<HardSoftScore>,
}The embedded solver service is automatically started when needed, eliminating the need to manually manage the Java process.
Modules§
- analysis
- constraints
- domain
- entity_
context - Thread-local context for canonical entity deduplication during deserialization.
- prelude
- Commonly used types for constraint solving
- score
- solver
- util
- wasm
Structs§
- Async
Solve Response - Bendable
Decimal Score - Bendable
Score - Class
Info - Constraint
- Constraint
Configuration - Constraint
Match - Constraint
Set - Constraint
Weight - Deep
Planning Clone - Default
Problem Change Director - Default implementation of ProblemChangeDirector for local use.
- Default
Variable Listener Context - Default implementation of VariableListenerContext for local use.
- Diminished
Returns Config - Domain
Accessor - Getter/setter accessor for a field
- Domain
Object Dto - Domain object definition with fields and optional mapper Fields use IndexMap to preserve insertion order, which is critical for correct WASM memory layout alignment.
- Domain
Object Mapper - Mapper for parsing/serializing solution objects
- Embedded
Service - Expr
- Fluent builder for constructing expression trees
- Field
Descriptor - Field descriptor with type, accessor, and annotations
- Field
Info - Field
Layout - Function
Handle - Opaque handle to a language-specific callable (function/lambda)
- Hard
Medium Soft Decimal Score - Hard
Medium Soft Score - Hard
Soft Decimal Score - Hard
Soft Score - A score with hard and soft components.
- Http
Solver Service - Indictment
- JarManager
- Layout
Calculator - List
Accessor Dto - List accessor for WASM list operations JSON field names match Java’s DomainListAccessor
- Memory
Layout - Named
Expression - An expression bundled with a function name for use in constraint streams.
- Object
Handle - Opaque handle to a language-specific object
- Predicate
Definition - Definition of a predicate function to be compiled into WASM.
- Score
Dto - Score
Explanation - Service
Config - Simple
Decimal Score - Simple
Score - Solution
Manager - Solve
Handle - Solve
Request - Solve request matching solverforge-wasm-service’s PlanningProblem schema Uses IndexMap for domain and constraints to preserve insertion order.
- Solve
Response - Solve
Status - Solver
- Solver
Builder - Builder for creating solvers from
PlanningSolutiontypes. - Solver
Config - Solver
Factory - Solver
Manager - Manages multiple concurrent solves for planning problems.
- Solver
Stats - Performance statistics from a solver run.
- Source
Variable Ref - Reference to a source variable that triggers a listener.
- Termination
Config - Configuration for when the solver should stop.
- Typed
Solver - A solver that is typed to a specific
PlanningSolutiontype. - Variable
Listener Registration - Registration information for a variable listener.
- Wasm
Function - Wasm
Module Builder
Enums§
- Class
Annotation - Class-level annotations (applied to the class itself, not fields)
- Collector
- Environment
Mode - Expression
- Rich expression tree for constraint predicates
- Joiner
- Listener
Callback Dto - DTO for transmitting listener callbacks to/from the solver service.
- Move
Thread Count - Planning
Annotation - Planning annotations for domain fields.
- Problem
Change Dto - Serializable DTO for transmitting problem changes to the solver service.
- Problem
Change Error - Error type for problem change operations.
- Service
Error - Shadow
Annotation - Solve
State - Solver
Forge Error - Main error type for SolverForge operations
- Stream
Component - A component in a constraint stream pipeline.
- Value
- Language-agnostic value representation
- Wasm
Memory Type
Constants§
- DEFAULT_
SERVICE_ URL - Default service URL for the solver service.
Traits§
- Domain
Struct - Trait for structs that can be represented in the domain model.
- Field
Access Ext - Extension trait for chaining field access
- Into
Named Expression - Extension trait for converting expressions to named expressions.
- Language
Bridge - List
Variable Listener - Listener for list planning variables (multi-valued).
- Planning
Entity - Marker trait for types that can be used as planning entities.
- Planning
Solution - Marker trait for types that can be used as planning solutions.
- Problem
Change - A problem change represents a modification to the planning solution during solving.
- Problem
Change Director - Director for applying problem changes to the working solution.
- Score
- Solver
Service - Variable
Listener - Listener for basic planning variables (single-valued).
- Variable
Listener Context - Context provided to variable listeners during callbacks.
Type Aliases§
- Change
Consumer - Type alias for consumer functions used by ProblemChangeDirector.
- Service
Result - Solver
Forge Result
Derive Macros§
- Domain
Struct - Derive macro for implementing the
DomainStructtrait. - Planning
Entity - Derive macro for implementing the
PlanningEntitytrait. - Planning
Solution - Derive macro for implementing the
PlanningSolutiontrait.