Skip to content

BeamSearchTraits

BeamSearchTraits<TState> = object

Defined in: optimize/beam-search.ts:4

How a caller’s state space is expanded, scored and tested.

TState

isGoal: (state) => boolean

Defined in: optimize/beam-search.ts:12

Whether a state is a complete, acceptable solution.

TState

boolean


isTerminal: (state) => boolean

Defined in: optimize/beam-search.ts:18

Whether a state is a dead end to drop from the beam without expanding. Use () => false when nextStatesOf returning [] already covers it.

TState

boolean


nextStatesOf: (state) => readonly TState[]

Defined in: optimize/beam-search.ts:6

Expands a state into its successors. Return [] for a dead end.

TState

readonly TState[]


scoreOf: (state) => number

Defined in: optimize/beam-search.ts:9

Scores a state. Higher is better — the beam keeps the highest.

TState

number