Skip to content

Add a C++/WebAssembly schedule solver with verified conflict explanations - #52

Draft
aikhanjum wants to merge 1 commit into
mainfrom
feat/semester-solver
Draft

aikhanjum wants to merge 1 commit into
mainfrom
feat/semester-solver

Conversation

@aikhanjum

Copy link
Copy Markdown
Collaborator

PI can display a saved timetable but has no local engine for finding ranked alternatives under section locks, time bounds, protected intervals, and free weekdays. This adds a freestanding C++17 solver compiled to WebAssembly, a validated TypeScript interface, and a Junction payload adapter.

The solver precomputes conflict bitsets, searches the most constrained remaining group, and uses admissible branch-and-bound bounds to return up to three ranked schedules. Results distinguish proved optimality, proved infeasibility, and an unfinished search. Conflict analysis retains unknown subproblems and returns a proposed relaxation only after finding a complete schedule under it.

The Wasm module uses fixed 512 KiB memory and has no imports or allocator. This layer adds the engine and its checks. Follow-up PRs add the interactive planner and offline demo.

Validation executed locally on Apple M5 Pro with Node 26.

  • npm run build:solver passed.
  • npm run test:solver-native passed under ASan and UBSan, including 20,000 ABI mutations.
  • npm test passed all 60 tests. The new solver suite includes 300 seeded comparisons against an independent exhaustive oracle, exact top-three rankings, an impossible three-groups/two-slots case, bounded search status, and input validation.
  • npx wrangler types, npm run typecheck, npm run build, and git diff --check passed.
  • npm run bench:solver provides a reproducible warm-call measurement with hashes, input sizes, sample counts, and variability. The synthetic eight-group fixture measured 0.153 ms median, or 0.055 ms with Friday protected, over 1,000 samples each. Timing includes JS validation, encoding, Wasm, and decoding. It excludes compilation, worker startup, diagnosis, and rendering. This is not a production latency or speedup claim.

Live Junction account integration, linked-section restrictions, prerequisites, travel time, and registration eligibility are unverified or unsupported. The adapter fails explicitly on missing records. No course registration or Junction writes occur.

Implemented with Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant