Skip to main content

AI Constraint Solving Lab v2

Constraint-solving engine with live algorithm visualization, complete execution replay, and controlled benchmarking

An interactive constraint-solving platform for inspecting search algorithms, replaying execution histories, and benchmarking solver strategies.

Role
Software Engineer — Algorithms & Full-Stack Systems
Year
2026

Technologies

Python
FastAPI
React
TypeScript
Pydantic
Server-Sent Events (SSE)
Zod
gzip JSONL
pytest
Hypothesis
Vitest
Vite

Project media

AI Solver Workspace

Technical context

Constraint-solving algorithms can reach the same solution through fundamentally different search strategies. Understanding these differences requires visibility into variable selection, constraint propagation, and backtracking rather than examining final results alone.

Problem

Design a system that makes algorithmic decisions observable and reproducible without coupling the solver engine to the visualization interface or introducing tracing overhead into performance measurements.

Project overview

The platform is built around a Python constraint-satisfaction engine that solves KenKen puzzles using strategies ranging from basic depth-first search to Maintaining Arc Consistency. Forward Checking, cage-support propagation, AC-3, and configurable MRV, Degree, and LCV heuristics provide different approaches to reducing the search space.

FastAPI manages background solver execution and streams structured events to a React/TypeScript interface. The frontend reconstructs algorithm state for live inspection and archived replay, while a separate benchmark execution path measures solver performance independently of visualization and event recording.

Technical approach

  • Design an immutable KenKen domain model with reusable constraint and solution-validation logic
  • Implement six solver families with configurable search heuristics and constraint propagation
  • Introduce typed execution events to separate solver logic from visualization
  • Build background execution, live streaming, and checkpoint-based historical replay
  • Develop an isolated benchmarking pipeline with repeated measurements and consistency validation

Technical focus

  • Constraint satisfaction, heuristic search, and algorithm optimization
  • Forward Checking, generalized arc consistency, and Maintaining Arc Consistency
  • Deterministic event modeling and solver-state reconstruction
  • Concurrent execution, cancellation, and event streaming
  • Performance measurement and benchmark repeatability

Architecture notes

  • Framework-independent CSP domain and centralized solver catalog
  • FastAPI execution services with background workers, cooperative cancellation, and reconnectable SSE
  • Bounded live-event buffering with explicit cursor-expiration handling
  • Disk-backed compressed execution traces with checkpoints and paginated retrieval
  • Separate benchmark service executing fresh solver instances without visualization overhead

Engineering highlights

  • 26 solver configurations spanning six search and propagation families
  • 16 typed event kinds capturing search decisions, domain changes, and constraint propagation
  • Three visualization modes covering final solutions, live execution, and complete archived replay
  • Checkpoint-based navigation through large execution histories beyond the live-event window
  • Controlled benchmark trials with warmups, repeated measurements, and deterministic consistency checks

Outcome

Implemented 26 solver configurations across six algorithm families, with live visualization and complete historical execution replay. The platform also supports controlled multi-solver benchmark sessions with timing statistics, search metrics, and repeatability validation.