/**
 * Monte Carlo Tree Search for Code Generation
 *
 * Implements MCTS with the Rethink mechanism for refining erroneous thoughts.
 * Based on RethinkMCTS (arXiv 2409.09584).
 */
import { ThoughtNode, MCTSConfig, MCTSStats, ReasoningResult, Problem, ExecutionResult } from "./types.js";
/**
 * Monte Carlo Tree Search implementation
 */
export declare class MCTS {
    private config;
    private root;
    private stats;
    private startTime;
    private generateThoughts;
    private evaluateThought;
    private executeCode;
    private refineThought;
    constructor(config: Partial<MCTSConfig> | undefined, callbacks: {
        generateThoughts: (node: ThoughtNode, problem: Problem) => Promise<string[]>;
        evaluateThought: (node: ThoughtNode, problem: Problem) => Promise<number>;
        executeCode: (code: string) => Promise<ExecutionResult>;
        refineThought: (node: ThoughtNode, feedback: string) => Promise<string>;
    });
    /**
     * Run MCTS search for a problem
     */
    search(problem: Problem): Promise<ReasoningResult>;
    /**
     * Create a thought node
     */
    private createNode;
    /**
     * Select the most promising node using UCB1
     */
    private select;
    /**
     * Calculate UCB1 value for a node
     */
    private calculateUCB1;
    /**
     * Expand a node by generating child thoughts
     */
    private expand;
    /**
     * Determine the type of thought based on content and depth
     */
    private determineThoughtType;
    /**
     * Simulate from a node (rollout)
     */
    private simulate;
    /**
     * Backpropagate scores up the tree
     */
    private backpropagate;
    /**
     * Rethink mechanism - refine erroneous thoughts
     */
    private rethink;
    /**
     * Find nodes that need rethinking
     */
    private findNodesNeedingRethink;
    /**
     * Find the best solution in the tree
     */
    private findBestSolution;
    /**
     * Get the path from root to a node
     */
    private getPathToNode;
    /**
     * Get alternative solutions
     */
    private getAlternatives;
    /**
     * Extract code from thought content
     */
    private extractCode;
    /**
     * Build the final result
     */
    private buildResult;
    /**
     * Get current statistics
     */
    getStats(): MCTSStats;
    /**
     * Get the tree root
     */
    getRoot(): ThoughtNode | null;
    /**
     * Format tree for display
     */
    formatTree(node?: ThoughtNode, indent?: string): string;
}
/**
 * Create an MCTS instance with default callbacks
 */
export declare function createMCTS(config: Partial<MCTSConfig> | undefined, callbacks: {
    generateThoughts: (node: ThoughtNode, problem: Problem) => Promise<string[]>;
    evaluateThought: (node: ThoughtNode, problem: Problem) => Promise<number>;
    executeCode: (code: string) => Promise<ExecutionResult>;
    refineThought: (node: ThoughtNode, feedback: string) => Promise<string>;
}): MCTS;
