import { Constraint } from 'draco-core'; import { TopLevelUnitSpec } from 'vega-lite/build/src/spec/unit'; /** * Options for Draco. */ export interface Options { /** * Empty means all. */ constraints?: string[]; /** * Weight for the soft constraints. */ weights?: Array<{ name: string; value: number; }>; /** * Number of models. */ models?: number; /** * If true, hard constraints will not be strictly enforced, instead * incurring an infinite cost. */ relaxHard?: boolean; } export interface Model { costs: number[]; facts: string[]; violations: Violation[]; } export interface Violation extends Constraint { witness: string; } export interface SolutionSet { models: Model[]; programs: string[]; specs: TopLevelUnitSpec[]; result: any; } export interface FieldTypes { [field: string]: string; } export interface Schema { stats: any; size: number; } export interface ConstraintSet { soft: Constraint[]; hard: Constraint[]; } /** * Draco is a solver that recommends visualization specifications based off * partial specs. */ declare class Draco { initialized: boolean; private Module; private stdout; private schema; private soft; private hard; private constraints; /** * @param url The base path of the server hosting this. * @param updateStatus Optional callback to log updates for status changes. */ constructor(url?: string, updateStatus?: (text: string) => void); /** * Initializes the underlying solver. * * @returns A promise that resolves when the solver is ready. */ init(): Promise; /** * Solves with the given constraints. * * @param program The constraint to solve (e.g. the partial specification in ASP) * @param options Options for solving. * * @returns The solution from Clingo as JSON. */ solve(program: string, options?: Options): SolutionSet | null; getSchema(): Schema | null; prepareData(data: any[]): void; updateAsp(aspSet: any): void; getConstraintSet(): ConstraintSet; setConstraintSet(constraintSet: ConstraintSet): void; private getDataDeclaration; } export default Draco;