/** * Agentic QE v3 - Oscillator Neuron * ADR-032: Kuramoto CPG oscillators for self-sustaining scheduling * * Implements the Kuramoto model for phase synchronization: * dφ/dt = ω + K * Σ sin(φⱼ - φᵢ) * * Where: * φ = phase angle * ω = natural frequency * K = coupling strength */ import { OscillatorState } from './types'; /** * Oscillator Neuron implementing Kuramoto dynamics * * Models a single oscillator in the CPG network. * Uses cosine activation for activity level. */ export declare class OscillatorNeuron { private id; private phase; private omega; private amplitude; private activity; /** * Create a new oscillator neuron * * @param id - Unique oscillator identifier * @param frequencyHz - Natural frequency in Hz * @param phaseOffset - Initial phase offset in radians * @param amplitude - Oscillation amplitude (default 1.0) */ constructor(id: number, frequencyHz: number, phaseOffset?: number, amplitude?: number); /** * Integrate oscillator dynamics over one time step * * Implements Kuramoto-like dynamics: * dφ/dt = ω + coupling_input * * Where coupling_input is the sum of: * K * sin(φⱼ - φᵢ) for all coupled oscillators j * * @param dt - Time step in milliseconds * @param couplingInput - Sum of coupling forces from other oscillators */ integrate(dt: number, couplingInput: number): void; /** * Integrate with external phase forcing * * Allows modulating the natural frequency with quality feedback * * @param dt - Time step in milliseconds * @param couplingInput - Sum of coupling forces * @param frequencyModulation - Modulation to natural frequency (-1 to 1) */ integrateWithModulation(dt: number, couplingInput: number, frequencyModulation?: number): void; /** * Get the current phase angle * * @returns Phase in radians [0, 2π) */ getPhase(): number; /** * Get the current activity level * * @returns Activity level [-amplitude, +amplitude] */ getActivity(): number; /** * Get the oscillator's unique identifier */ getId(): number; /** * Get the natural angular frequency * * @returns Angular frequency in rad/ms */ getOmega(): number; /** * Get the oscillation amplitude */ getAmplitude(): number; /** * Set the oscillation amplitude * * @param amplitude - New amplitude value */ setAmplitude(amplitude: number): void; /** * Set the natural frequency * * @param frequencyHz - New frequency in Hz */ setFrequency(frequencyHz: number): void; /** * Reset the oscillator to a specific phase * * @param phase - Phase angle in radians */ reset(phase: number): void; /** * Get the complete state of the oscillator */ getState(): OscillatorState; /** * Restore oscillator from state * * @param state - State to restore */ restoreState(state: OscillatorState): void; /** * Compute Kuramoto coupling input from another oscillator * * @param other - The other oscillator * @param couplingStrength - Coupling strength K * @returns Coupling force: K * sin(φⱼ - φᵢ) */ computeCouplingFrom(other: OscillatorNeuron, couplingStrength: number): number; /** * Check if this oscillator is in phase with another * * @param other - The other oscillator * @param tolerance - Phase difference tolerance in radians * @returns True if oscillators are in phase */ isInPhaseWith(other: OscillatorNeuron, tolerance?: number): boolean; /** * Check if this oscillator is anti-phase with another * * @param other - The other oscillator * @param tolerance - Phase difference tolerance in radians * @returns True if oscillators are anti-phase */ isAntiPhaseWith(other: OscillatorNeuron, tolerance?: number): boolean; /** * Normalize phase to [0, 2π) range */ private normalizePhase; /** * Create a copy of this oscillator */ clone(): OscillatorNeuron; } /** * Compute the Kuramoto order parameter for a set of oscillators * * The order parameter r measures synchronization: * r * e^(iψ) = (1/N) * Σ e^(iφⱼ) * * Where: * r = magnitude (0 = desynchronized, 1 = fully synchronized) * ψ = mean phase * * @param oscillators - Array of oscillator neurons * @returns Object containing order parameter r and mean phase psi */ export declare function computeOrderParameter(oscillators: OscillatorNeuron[]): { r: number; psi: number; }; /** * Compute phase coherence between oscillators * * Coherence measures how consistent the phase differences are over time * * @param phases - Array of phase arrays (one per oscillator) * @returns Coherence value (0 = incoherent, 1 = perfectly coherent) */ export declare function computePhaseCoherence(phases: number[][]): number; /** * Create evenly spaced oscillators for a CPG * * @param count - Number of oscillators * @param frequencyHz - Oscillation frequency in Hz * @returns Array of oscillators with evenly distributed initial phases */ export declare function createEvenlySpacedOscillators(count: number, frequencyHz: number): OscillatorNeuron[]; /** * Build a ring coupling matrix for nearest-neighbor coupling * * @param count - Number of oscillators * @param couplingStrength - Coupling strength K * @returns 2D coupling matrix */ export declare function buildRingCouplingMatrix(count: number, couplingStrength: number): number[][]; /** * Build an all-to-all coupling matrix * * @param count - Number of oscillators * @param couplingStrength - Coupling strength K * @returns 2D coupling matrix */ export declare function buildAllToAllCouplingMatrix(count: number, couplingStrength: number): number[][]; //# sourceMappingURL=oscillator.d.ts.map