Crate solverforge

Crate solverforge 

Source
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§

AsyncSolveResponse
BendableDecimalScore
BendableScore
ClassInfo
Constraint
ConstraintConfiguration
ConstraintMatch
ConstraintSet
ConstraintWeight
DeepPlanningClone
DefaultProblemChangeDirector
Default implementation of ProblemChangeDirector for local use.
DefaultVariableListenerContext
Default implementation of VariableListenerContext for local use.
DiminishedReturnsConfig
DomainAccessor
Getter/setter accessor for a field
DomainObjectDto
Domain object definition with fields and optional mapper Fields use IndexMap to preserve insertion order, which is critical for correct WASM memory layout alignment.
DomainObjectMapper
Mapper for parsing/serializing solution objects
EmbeddedService
Expr
Fluent builder for constructing expression trees
FieldDescriptor
Field descriptor with type, accessor, and annotations
FieldInfo
FieldLayout
FunctionHandle
Opaque handle to a language-specific callable (function/lambda)
HardMediumSoftDecimalScore
HardMediumSoftScore
HardSoftDecimalScore
HardSoftScore
A score with hard and soft components.
HttpSolverService
Indictment
JarManager
LayoutCalculator
ListAccessorDto
List accessor for WASM list operations JSON field names match Java’s DomainListAccessor
MemoryLayout
NamedExpression
An expression bundled with a function name for use in constraint streams.
ObjectHandle
Opaque handle to a language-specific object
PredicateDefinition
Definition of a predicate function to be compiled into WASM.
ScoreDto
ScoreExplanation
ServiceConfig
SimpleDecimalScore
SimpleScore
SolutionManager
SolveHandle
SolveRequest
Solve request matching solverforge-wasm-service’s PlanningProblem schema Uses IndexMap for domain and constraints to preserve insertion order.
SolveResponse
SolveStatus
Solver
SolverBuilder
Builder for creating solvers from PlanningSolution types.
SolverConfig
SolverFactory
SolverManager
Manages multiple concurrent solves for planning problems.
SolverStats
Performance statistics from a solver run.
SourceVariableRef
Reference to a source variable that triggers a listener.
TerminationConfig
Configuration for when the solver should stop.
TypedSolver
A solver that is typed to a specific PlanningSolution type.
VariableListenerRegistration
Registration information for a variable listener.
WasmFunction
WasmModuleBuilder

Enums§

ClassAnnotation
Class-level annotations (applied to the class itself, not fields)
Collector
EnvironmentMode
Expression
Rich expression tree for constraint predicates
Joiner
ListenerCallbackDto
DTO for transmitting listener callbacks to/from the solver service.
MoveThreadCount
PlanningAnnotation
Planning annotations for domain fields.
ProblemChangeDto
Serializable DTO for transmitting problem changes to the solver service.
ProblemChangeError
Error type for problem change operations.
ServiceError
ShadowAnnotation
SolveState
SolverForgeError
Main error type for SolverForge operations
StreamComponent
A component in a constraint stream pipeline.
Value
Language-agnostic value representation
WasmMemoryType

Constants§

DEFAULT_SERVICE_URL
Default service URL for the solver service.

Traits§

DomainStruct
Trait for structs that can be represented in the domain model.
FieldAccessExt
Extension trait for chaining field access
IntoNamedExpression
Extension trait for converting expressions to named expressions.
LanguageBridge
ListVariableListener
Listener for list planning variables (multi-valued).
PlanningEntity
Marker trait for types that can be used as planning entities.
PlanningSolution
Marker trait for types that can be used as planning solutions.
ProblemChange
A problem change represents a modification to the planning solution during solving.
ProblemChangeDirector
Director for applying problem changes to the working solution.
Score
SolverService
VariableListener
Listener for basic planning variables (single-valued).
VariableListenerContext
Context provided to variable listeners during callbacks.

Type Aliases§

ChangeConsumer
Type alias for consumer functions used by ProblemChangeDirector.
ServiceResult
SolverForgeResult

Derive Macros§

DomainStruct
Derive macro for implementing the DomainStruct trait.
PlanningEntity
Derive macro for implementing the PlanningEntity trait.
PlanningSolution
Derive macro for implementing the PlanningSolution trait.