UNPKG

dancing-links

Version:

Fastest JS solver for exact cover problems using Dancing Links

35 lines (34 loc) 1.43 kB
/** * Complex constraint handler for primary + secondary columns mode * * Zero branching - columnIndices is always { primary: number[], secondary: number[] } * columnValues is always { primaryRow: BinaryNumber[], secondaryRow: BinaryNumber[] } */ import { ConstraintRow, BinaryNumber, ComplexSolverConfig, ConstraintHandler, SparseConstraintBatch, BinaryConstraintBatch } from '../../types/interfaces.js'; export declare class ComplexConstraintHandler<T> implements ConstraintHandler<T, 'complex'> { private config; readonly mode: "complex"; private constraints; private validationEnabled; private numPrimary; private numSecondary; constructor(config: ComplexSolverConfig); validateConstraints(): this; addSparseConstraint(data: T, columnIndices: { primary: number[]; secondary: number[]; }): this; addSparseConstraints(constraints: SparseConstraintBatch<T, 'complex'>): this; addBinaryConstraint(data: T, columnValues: { primaryRow: BinaryNumber[]; secondaryRow: BinaryNumber[]; }): this; addBinaryConstraints(constraints: BinaryConstraintBatch<T, 'complex'>): this; addRow(row: ConstraintRow<T>): this; addRows(rows: ConstraintRow<T>[]): this; getConstraints(): ConstraintRow<T>[]; getNumPrimary(): number; getNumSecondary(): number; getConfig(): ComplexSolverConfig; isValidationEnabled(): boolean; }