solverforge_core/
lib.rs

1//! SolverForge Core - Language-agnostic constraint solver library
2//!
3//! This crate provides the core functionality for SolverForge, a Rust-based
4//! constraint solver library that uses WASM modules and HTTP communication
5//! to solve constraint satisfaction and optimization problems by acting as a
6//! bridge towards the Timefold JVM.
7//!
8//! # Architecture
9//!
10//! SolverForge is designed with a layered architecture:
11//!
12//! 1. **Core Types** (this crate) - Language-agnostic types and abstractions
13//! 2. **Language Bindings** - Language-specific implementations (Python, JS, etc.)
14//! 3. **Solver Service** - HTTP service that executes the solving
15//!
16//! # Key Components
17//!
18//! - [`Value`] - Language-agnostic value representation
19//! - [`ObjectHandle`] / [`FunctionHandle`] - Opaque handles to host language objects
20//! - [`SolverForgeError`] / [`SolverForgeResult`] - Error handling types
21//!
22//! # Example
23//!
24//! ```
25//! use solverforge_core::{Value, ObjectHandle, FunctionHandle};
26//!
27//! // Create values
28//! let int_val = Value::from(42i64);
29//! let str_val = Value::from("hello");
30//!
31//! // Create handles
32//! let obj_handle = ObjectHandle::new(1);
33//! let func_handle = FunctionHandle::new(2);
34//!
35//! // Use in a map
36//! use std::collections::HashMap;
37//! let mut map = HashMap::new();
38//! map.insert(obj_handle, "object 1");
39//! ```
40
41pub mod analysis;
42mod bridge;
43pub mod constraints;
44pub mod domain;
45mod error;
46mod handles;
47pub mod score;
48pub mod solver;
49mod traits;
50mod value;
51pub mod wasm;
52
53pub use analysis::{ConstraintMatch, Indictment, ScoreExplanation, SolutionManager};
54pub use bridge::{ClassInfo, FieldInfo, LanguageBridge};
55pub use constraints::{
56    Collector, Constraint, ConstraintSet, Joiner, StreamComponent, WasmFunction,
57};
58pub use domain::{
59    ConstraintConfiguration, ConstraintWeight, DeepPlanningClone, PlanningAnnotation,
60    ShadowAnnotation,
61};
62pub use error::{SolverForgeError, SolverForgeResult};
63pub use handles::{FunctionHandle, ObjectHandle};
64pub use score::{
65    BendableDecimalScore, BendableScore, HardMediumSoftDecimalScore, HardMediumSoftScore,
66    HardSoftDecimalScore, HardSoftScore, Score, SimpleDecimalScore, SimpleScore,
67};
68pub use solver::{
69    AsyncSolveResponse, DiminishedReturnsConfig, DomainAccessor, DomainObjectDto,
70    DomainObjectMapper, EnvironmentMode, FieldDescriptor, HttpSolverService, ListAccessorDto,
71    MoveThreadCount, PlanningAnnotation as SolverPlanningAnnotation, ScoreDto, SolveHandle,
72    SolveRequest, SolveResponse, SolveState, SolveStatus, Solver, SolverBuilder, SolverConfig,
73    SolverFactory, SolverService, SolverStats, TerminationConfig, TypedSolver, DEFAULT_SERVICE_URL,
74};
75pub use traits::{PlanningEntity, PlanningSolution};
76pub use value::Value;
77pub use wasm::{
78    Comparison, FieldAccess, FieldLayout, LayoutCalculator, MemoryLayout, PredicateDefinition,
79    WasmMemoryType, WasmModuleBuilder,
80};