/** * Gradient-Free Tuning Algorithm * ADR-024: Self-Optimization Engine * * Implements a gradient-free optimization algorithm for parameter tuning. * Uses a combination of coordinate descent and random exploration. */ import type { TunableParameter, TuningConfig, EvaluationResult, ParameterSuggestion, MetricStats } from './types.js'; /** * Interface for tuning algorithms */ export interface TuningAlgorithm { /** * Generate next parameter configuration to evaluate */ suggestNextConfiguration(parameters: TunableParameter[], history: EvaluationResult[], config: TuningConfig): Record; /** * Generate improvement suggestions based on evaluation history */ generateSuggestions(parameters: TunableParameter[], history: EvaluationResult[], metricStats: Map): ParameterSuggestion[]; /** * Calculate score for a configuration */ calculateScore(parameters: TunableParameter[], metricValues: Record): number; } /** * Gradient-free tuning using coordinate descent with random exploration * * Strategy: * 1. With probability (1 - explorationRate): Exploit by moving toward better configurations * 2. With probability explorationRate: Explore by trying random perturbations * 3. Evaluate and update best known configuration */ export declare class CoordinateDescentTuner implements TuningAlgorithm { private bestConfiguration; private bestScore; private currentParameterIndex; private currentDirection; private stepsWithoutImprovement; /** * Suggest next configuration to evaluate */ suggestNextConfiguration(parameters: TunableParameter[], history: EvaluationResult[], config: TuningConfig): Record; /** * Generate a configuration by perturbing current best along one dimension */ private generateExploitConfiguration; /** * Generate a random exploratory configuration */ private generateExploratoryConfiguration; /** * Perturb a single parameter */ private perturbParameter; /** * Perturb a numeric parameter */ private perturbNumeric; /** * Perturb a categorical parameter */ private perturbCategorical; /** * Generate improvement suggestions */ generateSuggestions(parameters: TunableParameter[], history: EvaluationResult[], metricStats: Map): ParameterSuggestion[]; /** * Analyze a parameter and suggest improvements */ private analyzeParameter; /** * Calculate correlation between parameter values and metric in history */ private calculateCorrelation; /** * Calculate score for a configuration */ calculateScore(parameters: TunableParameter[], metricValues: Record): number; /** * Shuffle array (Fisher-Yates) */ private shuffleArray; /** * Reset the algorithm state */ reset(): void; } /** * Create the default tuning algorithm */ export declare function createTuningAlgorithm(): TuningAlgorithm; //# sourceMappingURL=tuning-algorithm.d.ts.map