Skip to main content

Interface: SolverClient

Methods

health()?

optional health(): Promise<void>;

Returns

Promise<void>

solve()

solve(request, options?): Promise<{
  error?: string;
  softViolations?: {
     actualValue: number;
     constraintId: string;
     targetValue: number;
     violationAmount: number;
  }[];
  solutionInfo?: string;
  statistics?: {
     branches?: number;
     conflicts?: number;
     solveTimeMs?: number;
  };
  status: "OPTIMAL" | "FEASIBLE" | "INFEASIBLE" | "TIMEOUT" | "ERROR";
  values?: Record<string, number>;
}>;

Parameters

ParameterType
request{ constraints: ( | { op: "<=" | ">=" | "=="; rhs: number; terms: { coeff: number; var: string; }[]; type: "linear"; } | { id?: string; op: "<=" | ">="; penalty: number; rhs: number; terms: { coeff: number; var: string; }[]; type: "soft_linear"; } | { type: "exactly_one"; vars: string[]; } | { type: "at_most_one"; vars: string[]; } | { if: string; then: string; type: "implication"; } | { type: "bool_or"; vars: string[]; } | { type: "bool_and"; vars: string[]; } | { intervals: string[]; type: "no_overlap"; })[]; objective?: { sense: "minimize" | "maximize"; terms: { coeff: number; var: string; }[]; }; options?: { solutionLimit?: number; timeLimitSeconds?: number; }; variables: ( | { name: string; type: "bool"; } | { max: number; min: number; name: string; type: "int"; } | { end: number; name: string; presenceVar?: string; size: number; start: number; type: "interval"; })[]; }
request.constraints( | { op: "<=" | ">=" | "=="; rhs: number; terms: { coeff: number; var: string; }[]; type: "linear"; } | { id?: string; op: "<=" | ">="; penalty: number; rhs: number; terms: { coeff: number; var: string; }[]; type: "soft_linear"; } | { type: "exactly_one"; vars: string[]; } | { type: "at_most_one"; vars: string[]; } | { if: string; then: string; type: "implication"; } | { type: "bool_or"; vars: string[]; } | { type: "bool_and"; vars: string[]; } | { intervals: string[]; type: "no_overlap"; })[]
request.objective?{ sense: "minimize" | "maximize"; terms: { coeff: number; var: string; }[]; }
request.objective.sense?"minimize" | "maximize"
request.objective.terms?{ coeff: number; var: string; }[]
request.options?{ solutionLimit?: number; timeLimitSeconds?: number; }
request.options.solutionLimit?number
request.options.timeLimitSeconds?number
request.variables?( | { name: string; type: "bool"; } | { max: number; min: number; name: string; type: "int"; } | { end: number; name: string; presenceVar?: string; size: number; start: number; type: "interval"; })[]
options?{ signal?: AbortSignal; }
options.signal?AbortSignal

Returns

Promise<{ error?: string; softViolations?: { actualValue: number; constraintId: string; targetValue: number; violationAmount: number; }[]; solutionInfo?: string; statistics?: { branches?: number; conflicts?: number; solveTimeMs?: number; }; status: "OPTIMAL" | "FEASIBLE" | "INFEASIBLE" | "TIMEOUT" | "ERROR"; values?: Record<string, number>; }>