Skip to main content

TypeScript API Reference

This is the auto-generated API reference for the OptalCP TypeScript/JavaScript library.

New to OptalCP? Start with the Tutorial for a hands-on introduction, or Quick Start for installation.

Key Classes​

ClassDescription
ModelCentral class for building optimization models. Creates variables, constraints, and objectives.
IntervalVarInterval (task) variable for scheduling. Has start, end, length, and optional presence.
IntVarInteger decision variable with a domain.
SequenceVarOrdered sequence of intervals for routing and sequencing problems.
SolverAdvanced solving with callbacks for solutions, bounds, and logs.
SolutionAccess to variable values after solving.

Common Entry Points​

Creating a Model​

import * as CP from "@scheduleopt/optalcp";
const model = new CP.Model();

See Model for all factory methods: intVar, intervalVar, sequenceVar.

Solving​

Constraints​

Most constraints are methods on Model:

Expressions​

Expressions use a fluent API. See IntExpr for arithmetic methods (.plus(), .times(), .le()) and BoolExpr for boolean logic (.and(), .or(), .not()).

Interval expressions: start(), end(), length(), presence().

Parameters​

Parameters controls solver behavior: timeLimit, nbWorkers, searchType, logLevel, etc.

Parse from command line: parseParameters, parseKnownParameters.

Solution Access​

Solution methods: getStart, getEnd, getValue, isAbsent.

Model Export​

Benchmarking​

benchmark function with BenchmarkParameters.

Learn More​

Modeling​

Solving​

Parameters​

Benchmarking​

Constants​