Skip to main content

SolverForge

·285 words·2 mins
Author
Vittorio Distefano
Turning complex tech into systems that actually work.
A native constraint solver written from scratch in Rust, inspired by Timefold. Features a zero-erasure architecture with monomorphization and arena allocation for maximum performance.

What it solves
#

SolverForge tackles complex optimization problems—employee scheduling, vehicle routing, resource allocation—by finding optimal assignments against real-world constraints.

Scheduling
Routing
Resource Allocation

Architecture
#

Legacy: Python + JPype (Production)
#

The production solver uses JPype for direct in-process JVM access. Python bytecode is translated to Java bytecode at runtime via the JPyInterpreter, enabling constraint callbacks. Input data types are validated at the API boundary via Pydantic.

graph TD
    A["Python Model"]

    A --> B["JPype Bridge"]
    B --> C["JPyInterpreter"]
    C --> D["Java Bytecode"]
    D --> E["Timefold Solver"]
    E -.->|callbacks| B

Native: Rust Core (In Development)
#

The new architecture is a complete native solver written from scratch in Rust. It uses monomorphization for zero-cost constraint abstractions, arena allocation for cache-friendly memory access, and a zero-erasure design that preserves full type information at runtime.

graph TD
    A["Python Model"]

    A --> B["PyO3 Bindings"]
    B --> C["Rust Core"]
    C --> D["Monomorphized Constraints"]
    D --> E["Arena Allocator"]
    E --> F["Incremental Score Calculator"]
    F --> G["Metaheuristic Solver"]
Why native? Unlike Java’s type erasure, Rust’s monomorphization generates specialized code for each constraint type at compile time. Combined with arena allocation, this eliminates runtime overhead from dynamic dispatch and heap fragmentation — delivering predictable, near-optimal performance.

Project Timeline
#

  1. Continuity

    SolverForge (Legacy)

    Providing active maintenance the production-ready Python solver after Timefold deprecated official support.
  2. Rust Core

    SolverForge

    Building a native constraint solver with monomorphization and arena allocation for zero-overhead performance.
  3. Multi-language Support

    PyO3 Bindings

    Python bindings via PyO3, exposing the native solver with idiomatic Python APIs.

Tech Stack
#

Rust
Python
PyO3

Links#

Website GitHub PyPI HuggingFace