Skip to content
Rainbow docs menu

Reference · Algorithm guarantees

rainbow.algorithms.proofs.local-search

Algorithm guaranteessrc/rainbow/algorithms/proofs/local_search.clj2 definitions, 5 theorems

Bounded local (hill-climbing) search over a finite candidate set with exact rational objectives. A best-neighbor step delegates to the proven finite rational argmax: it picks the candidate maximizing the objective, keeping the current point as the fallback. Because the current point is itself a candidate, each step never decreases the objective -- the hill-climbing guarantee. The candidate/objective pair is a pluggable strategy (AHoF D40 DELEGATE).

search/nnrat-best-neighbor

DefinitionSource, line 59

search/nnrat-best-neighbor.{u} :
  (Theta : Type u) (candidates : Finset Theta) (current : Theta)
  (evaluate : Theta → ℚ≥0)
  → Theta

Finset = finset-data/Finsetℚ≥0 = nnrat/NonnegativeRational

search/nnrat-hill-climb

DefinitionSource, line 71

search/nnrat-hill-climb.{u} :
  (Theta : Type u) (candidates : Finset Theta) (evaluate : Theta → ℚ≥0) (x₁ : ℕ)
  (x₂ : Theta)
  → Theta

Finset = finset-data/Finsetℕ = data/Natℚ≥0 = nnrat/NonnegativeRational

search/nnrat-best-neighbor-is-candidate

TheoremFor all inputsNo axiomsSource, line 95

search/nnrat-best-neighbor-is-candidate.{u} :
  (Theta : Type u) (candidates : Finset Theta) (current : Theta)
  (evaluate : Theta → ℚ≥0)
  (current-member : current ∈ candidates)
  → search/nnrat-best-neighbor Theta candidates current evaluate ∈ candidates

Finset = finset-data/Finsetℚ≥0 = nnrat/NonnegativeRational∈ = finset-data/to-set: membership in a finite set

search/nnrat-best-neighbor-improves

TheoremFor all inputsNo axiomsSource, line 112

search/nnrat-best-neighbor-improves.{u} :
  (Theta : Type u) (candidates : Finset Theta) (current : Theta)
  (evaluate : Theta → ℚ≥0)
  (current-member : current ∈ candidates)
  → evaluate current ≤ evaluate (search/nnrat-best-neighbor Theta candidates current evaluate)

Finset = finset-data/Finsetℚ≥0 = nnrat/NonnegativeRational∈ = finset-data/to-set: membership in a finite set≤ = nnrat/at-most

search/nnrat-hill-climb-zero

TheoremHolds by unfolding a definitionNo axiomsSource, line 131

search/nnrat-hill-climb-zero.{u} :
  (Theta : Type u) (candidates : Finset Theta) (evaluate : Theta → ℚ≥0)
  (initial : Theta)
  → search/nnrat-hill-climb Theta candidates evaluate 0 initial = initial

= = equality/EqFinset = finset-data/Finsetℚ≥0 = nnrat/NonnegativeRational

search/nnrat-hill-climb-successor

TheoremFor all inputsNo axiomsSource, line 152

search/nnrat-hill-climb-successor.{u} :
  (Theta : Type u) (candidates : Finset Theta) (evaluate : Theta → ℚ≥0) (steps : ℕ)
  (initial : Theta)
  → climb (data/succ steps) initial = (fun x₁ => fun previous => search/nnrat-best-neighbor Theta candidates previous evaluate) steps (climb steps initial)
  where climb := search/nnrat-hill-climb Theta candidates evaluate

= = equality/EqFinset = finset-data/Finsetℕ = data/Natℚ≥0 = nnrat/NonnegativeRational

search/nnrat-best-neighbor-transfer

TheoremFor all inputsNo axiomsSource, line 177

search/nnrat-best-neighbor-transfer.{u} :
  (Theta : Type u) (candidates : Finset Theta) (evaluate : Theta → ℚ≥0) (left : Theta)
  (left-member : left ∈ candidates)
  (right : Theta)
  (right-member : right ∈ candidates)
  → proposition/conjunction (evaluate left ≤ evaluate (neighbor₁)) (evaluate right ≤ evaluate (neighbor))
  where neighbor := search/nnrat-best-neighbor Theta candidates right evaluate
  where neighbor₁ := search/nnrat-best-neighbor Theta candidates left evaluate

Finset = finset-data/Finsetℚ≥0 = nnrat/NonnegativeRational∈ = finset-data/to-set: membership in a finite set≤ = nnrat/at-most