Random Search
Uniformly sample a parent and context from the full candidate history.
"""Random-search Proposer component — the SEARCH/REPLACE diff operator."""
from __future__ import annotations
from ...components.proposer import LLMProposer, WholeLineDiff
class RandomProposer(LLMProposer):
"""One LLM call -> a SEARCH/REPLACE diff applied to the sampled parent, with no-op detection.
Diffs apply by whole-line matching (:class:`~galapagos.components.proposer.WholeLineDiff`); a
response that yields no matching diff block is a no-op that is retried/discarded rather than
accepted as a full rewrite. The variation operator is deliberately identical to the greedy
baseline's, so that random vs. elitist *selection* is the only independent variable.
"""
edit_strategy = WholeLineDiff()