Installation
Set up `timetable-sa` in a modern Node.js or Bun TypeScript project.
Installation
This guide covers the minimal setup needed to use timetable-sa in a Node.js or
TypeScript project. The package is runtime-light, but it assumes you are
working in a modern JavaScript environment that supports the current Node.js
ecosystem.
Requirements
You need the following baseline environment:
- Node.js
18+or a compatible Bun runtime, - a TypeScript project if you want full type inference and generic state safety,
- an application-level module system compatible with modern package exports.
Install with your package manager
Install the package with your package manager.
npm install timetable-sapnpm add timetable-sayarn add timetable-sabun add timetable-saImport the public API
After installation, import the solver and the public types you need.
import { SimulatedAnnealing } from 'timetable-sa';
import type {
Constraint,
MoveGenerator,
SAConfig,
Solution,
ProgressStats,
} from 'timetable-sa';Runtime notes
Several operational details are useful to know before integration.
solve()is asynchronous and returnsPromise<Solution<TState>>.- if you use
onProgress, the defaultonProgressModeis'await', so slow callbacks can reduce throughput, - the solve result can include
solution.diagnostics, and you can also inspect the same grouped telemetry throughsolver.getDiagnostics()after the run, - file logging with
logging.output: 'file' | 'both'creates parent directories automatically, - move generators receive a solver-provided clone, so they may mutate the state
passed into
generate(...).
Recommended next step
Once installation is complete, continue to Quick Start for a minimal end-to-end solver example.