Classical AI · Constraint Satisfaction · Search & Reasoning
AI Constraint Solving Lab v2
Interactive classical AI laboratory for visualizing, replaying and benchmarking constraint-solving and search algorithms
A full-stack classical AI laboratory built around a custom constraint-satisfaction engine, interactive algorithm visualization, complete execution replay and controlled solver benchmarking.
- ROLE
- Software Engineer · AI & Algorithm Systems
- YEAR
- 2026
TECH_STACK
Technologies
MEDIA
Project media
CONTEXT
Technical context
The project began as a modernization of an older desktop KenKen algorithm visualizer I had previously built and evolved into a reusable classical AI experimentation platform. Instead of preserving the original tightly coupled implementation, I redesigned the system around an independent CSP domain model, multiple solver strategies, structured execution events, replayable traces, background execution and a modern web interface.
PROBLEM
Problem
Most solver implementations expose only a final solution and a small set of performance metrics. That makes it difficult to understand why one strategy performs better than another or what actually happens during search. The challenge was to make variable selection, candidate rejection, domain pruning, constraint propagation, arc consistency and backtracking observable without coupling the solver engine to the visualization layer or distorting benchmark results.
APPROACH
Technical approach
- Modeled KenKen as a reusable Constraint Satisfaction Problem with immutable puzzle and constraint structures
- Implemented a custom solver engine instead of delegating search to an external optimization library
- Built multiple search and propagation strategies from basic DFS to Maintaining Arc Consistency
- Added MRV, Degree and Least Constraining Value heuristics
- Separated algorithms from visualization through a typed solver-event architecture
- Implemented live execution, cancellation and deterministic event replay
- Added lossless disk-backed full traces with checkpoint-based historical seeking
- Built a responsive React and TypeScript interface for exploring solver behavior
- Created an isolated benchmark path that measures solvers without visualization or trace overhead
- Added multi-solver benchmark experiments with warmups, measured runs and optional search limits
FOCUS
Technical focus
- Classical artificial intelligence
- Constraint Satisfaction Problems
- Search algorithms
- Backtracking search
- Forward Checking
- Constraint propagation
- Minimum Remaining Values heuristic
- Degree heuristic
- Least Constraining Value ordering
- Arc consistency
- Maintaining Arc Consistency
- Deterministic algorithm replay
- Large execution-trace handling
- Concurrent background execution
- Benchmark design and repeatability
- Full-stack systems architecture
ARCHITECTURE
Architecture notes
- The CSP solver engine is independent from FastAPI and React
- A centralized solver catalog exposes 26 concrete configurations through one common interface
- Solver algorithms communicate with visualization through optional typed event sinks
- Canonical solver results and execution traces are separate data products
- Live visualization uses a bounded 100,000-event in-memory window
- Complete traces are stored as chunked gzip-compressed archives
- Replay checkpoints allow seeking through large histories without loading the full trace into browser memory
- FastAPI manages solve sessions, cancellation, streaming events, archived traces and benchmark sessions
- React reconstructs solver state from events instead of executing solver logic in the browser
- Benchmark execution bypasses visualization, SSE and full-trace recording to keep measurements meaningful
HIGHLIGHTS
Engineering highlights
- 26 solver configurations across six solver families
- Custom CSP engine implemented from the ground up
- Naive DFS, Backtracking, Forward Checking, Cage Support, AC-3 and MAC strategies
- MRV, Degree and LCV heuristic combinations
- Live visualization of assignments, backtracking and domain pruning
- Visualization of constraint propagation and arc-consistency operations
- 16 typed solver event kinds
- Final Solution, Live Replay and Full Archived Replay modes
- Lossless traces beyond the 100,000-event live window
- Checkpoint-based seeking through large solver histories
- Million-event trace stress validation
- Background execution with cooperative cancellation
- Controlled multi-solver benchmark experiments
- Strict runtime validation across Python and TypeScript boundaries
OUTCOME
Outcome
The result is a reusable AI experimentation environment rather than a single-purpose puzzle solver. The current system exposes 26 solver configurations across six solver families, supports live and complete historical replay, handles execution traces larger than the browser's live event window and provides controlled multi-solver benchmark execution. Strong constraint-propagation strategies can reduce difficult searches from thousands of explored nodes to fewer than one hundred on the project's 9×9 reference puzzle.