import type { Location } from "@thi.ng/zipper";
import type { ASTNode, ASTOpts } from "./api.js";
export declare class AST<OP, T> {
    opts: ASTOpts<OP, T>;
    choices: IterableIterator<number>;
    probTerminal: number;
    constructor(opts: ASTOpts<OP, T>);
    /**
     * Returns a random AST with given max tree depth. The max depth
     * provided in {@link ASTOpts} is used by default.
     *
     * @param maxDepth -
     */
    randomAST(maxDepth?: number): ASTNode<OP, T>;
    /**
     * Immutably transplants a randomly chosen subtree of `parent2` into
     * a randomly chosen location in `parent1` and vice versa. Returns 2
     * new trees.
     *
     * @param parent1 -
     * @param parent2 -
     */
    crossoverSingle(parent1: ASTNode<OP, T>, parent2: ASTNode<OP, T>): ASTNode<OP, T>[];
    /**
     * Probilistically replaces randomly chosen tree nodes with a new random AST
     * of given `maxDepth` (default: 1). Never mutates root.
     *
     * @remarks
     * The AST's pre-configured max tree depth will always be respected, so
     * depending on the depth of the selected mutation location, the randomly
     * inserted/replaced subtree might be more shallow than given `maxDepth`.
     * I.e. if a tree node at max depth is selected for mutation, it will always
     * result in a randomly chosen terminal node only.
     *
     * @param tree -
     * @param maxDepth -
     */
    mutate(tree: ASTNode<OP, T>, maxDepth?: number): ASTNode<OP, T>;
    /**
     * Returns linearized/flat version of given AST as an array of [zipper
     * locations](https://docs.thi.ng/umbrella/zipper/classes/Location.html).
     *
     * @param tree -
     */
    linearizedAST(tree: ASTNode<OP, T>): Location<ASTNode<OP, T>>[];
    /**
     * Returns random {@link ASTNode} from given tree, using the user provided
     * PRNG (via `opts`) or
     * [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html).
     * The returned value is a [zipper
     * location](https://docs.thi.ng/umbrella/zipper/classes/Location.html) of
     * the selected node.
     *
     * @remarks
     * The actual `ASTNode` can be obtained via `.node`.
     *
     * Only nodes in the linearized index range `[min..max)` are returned
     * (default: entire tree range). Since the linear tree length isn't known
     * beforehand, `max` < 0 (default) is equivalent to the linearized tree end.
     *
     * @param tree -
     * @param min -
     * @param max -
     */
    selectRandomNode(tree: ASTNode<OP, T>, min?: number, max?: number): Location<ASTNode<OP, T>>;
    protected randomASTNode(d: number, maxDepth: number): ASTNode<OP, T>;
    protected asZipper(tree: ASTNode<OP, T>): Location<ASTNode<OP, T>>;
}
//# sourceMappingURL=ast.d.ts.map