export declare const INVALID_LEFT: unique symbol; export declare const INVALID_RIGHT: unique symbol; export type OptimizationResult = [ iterationArg: ArgT, iterationResult: T, comparisonMeta: CompareT, rank: number, done: boolean ]; /** * The optimize function is a generic utility function to find the "best" input parameter/output result combination. * It works by computing results, and then comparing them with each other result. * It can be used to optimize an objective function by repeatedly evaluating it with different input parameters, * and comparing the results of these evaluations to determine the best result and input parameter combination. * The optimization is performed in a series of iterations, with each iteration producing a set of results. * Each iteration result is compared with each other iteration result, and the results are sorted by their comparison rank. * * @returns An array of optimization results sorted by their comparison rank. * Each result is an array with the iteration argument, the iteration result, the comparison metadata, the comparison rank and a done flag. */ export declare function optimize({ iterate, iterations, getComparisonCache, compare, getNextIterationArgument, reverseCompareMeta, }: { /** A function that returns the argument passed to the `iteration` function, based on the current iteration number. */ getNextIterationArgument: (iteration: number) => ArgT; /** The function that performs the calculation, for which optimization is sought. */ iterate: (iterationArg: ArgT) => T; /** The number of iterations to perform. */ iterations: number; /** An optional function to summarize or pre-compute data from all comparisons, passed to the `compare` function. */ getComparisonCache?: (allResults: readonly (readonly [iterationArg: ArgT, iterationResult: T])[]) => RefT; /** A function that compares two iteration results and returns an objective comparison rank and metadata, or an INVALID_LEFT, INVALID_RIGHT symbol either of the results should be rejected. */ compare: (a: T, b: T, indexA: number, indexB: number, comparisonReference?: RefT) => [compareRank: number, compareMeta: CompareT] | typeof INVALID_LEFT | typeof INVALID_RIGHT; reverseCompareMeta?: (meta: CompareT) => CompareT; }): OptimizationResult[]; //# sourceMappingURL=optimize.d.ts.map