SolverForge (Legacy)

Technical documentation for SolverForge Legacy — the pure Python constraint solver using the Timefold backend.

Every organization faces planning problems: providing products or services with a limited set of constrained resources (employees, assets, time, and money). SolverForge’s Planning AI optimizes these problems to do more business with fewer resources using Constraint Satisfaction Programming.

SolverForge is a lightweight, embeddable constraint satisfaction engine which optimizes planning problems. Example use cases include:

  • Vehicle Routing - Optimize delivery routes for fleets of vehicles
  • Employee Scheduling - Assign shifts to employees based on skills and availability
  • School Timetabling - Schedule lessons to timeslots and rooms
  • Meeting Scheduling - Find optimal times and rooms for meetings
  • Bin Packing - Efficiently pack items into containers
  • Task Assignment - Assign tasks to resources optimally

Use Case Overview

Python-First Design

SolverForge provides a Pythonic API using:

  • Decorators for domain modeling (@planning_entity, @planning_solution)
  • Type annotations with Annotated for constraint and property marking
  • Dataclasses for clean, readable domain models
  • Fluent constraint stream API for intuitive constraint definition
from dataclasses import dataclass, field
from typing import Annotated
from solverforge_legacy.solver.domain import (
    planning_entity, planning_solution,
    PlanningId, PlanningVariable, PlanningEntityCollectionProperty,
    ProblemFactCollectionProperty, ValueRangeProvider, PlanningScore
)
from solverforge_legacy.solver.score import HardSoftScore

@planning_entity
@dataclass
class Lesson:
    id: Annotated[str, PlanningId]
    subject: str
    teacher: str
    timeslot: Annotated[Timeslot | None, PlanningVariable] = field(default=None)
    room: Annotated[Room | None, PlanningVariable] = field(default=None)

@planning_solution
@dataclass
class Timetable:
    timeslots: Annotated[list[Timeslot], ProblemFactCollectionProperty, ValueRangeProvider]
    rooms: Annotated[list[Room], ProblemFactCollectionProperty, ValueRangeProvider]
    lessons: Annotated[list[Lesson], PlanningEntityCollectionProperty]
    score: Annotated[HardSoftScore, PlanningScore] = field(default=None)

Requirements

  • Python 3.10+ (3.11 or 3.12 recommended)
  • JDK 17+ (for the optimization engine backend)

Next Steps


Concepts

Understand the fundamental concepts of planning optimization and constraint solving.

Getting Started

Install SolverForge and solve your first planning problem.

Domain Modeling

Model your planning problem with entities, variables, and solutions.

Constraints

Define constraints using the fluent Constraint Streams API.

Solver

Configure and run the solver to find optimal solutions.

Optimization Algorithms

Understand the algorithms that power SolverForge’s optimization.

Design Patterns

Common patterns for handling real-world planning scenarios.

Integration

Integrate SolverForge with web frameworks and other systems.

Reference

API reference and frequently asked questions.