|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Classes | |
| struct | Dummy_State_Key |
| struct | History_Table_Selector |
| struct | History_Table_Selector< Domain, true > |
| struct | NodeEvaluation |
| struct | Null_Transposition_Table |
Functions | |
| template<AdversarialScore Score> | |
| constexpr Score | score_floor () noexcept |
| template<AdversarialScore Score> | |
| constexpr Score | score_ceiling () noexcept |
| template<typename Result > | |
| void | mark_limit_reached (Result &result) |
| template<SearchMove Move> | |
| SearchPath< Move > | prepend_move (const Move &move, const SearchPath< Move > &tail) |
| template<typename Domain , typename Result > | |
| auto | evaluate_leaf (Domain &domain, const typename Domain::State &state, Result &result) |
| constexpr size_t | remaining_depth (const SearchLimits &limits, const size_t depth) noexcept |
| void | accumulate_move_ordering_stats (MoveOrderingStats &dst, const MoveOrderingStats &src) noexcept |
| void | accumulate_transposition_stats (TranspositionStats &dst, const TranspositionStats &src) noexcept |
| void | accumulate_search_stats (SearchStats &dst, const SearchStats &src) noexcept |
| void | accumulate_adversarial_stats (AdversarialSearchStats &dst, const AdversarialSearchStats &src) noexcept |
| template<SearchMove Move, AdversarialScore Score, typename Tracer > requires AdversarialSearchTracer<Tracer, Move, Score> | |
| void | emit_trace (Tracer &tracer, const AdversarialTraceEventKind kind, const size_t depth, const size_t remaining, const size_t iteration=0, const size_t horizon=0, const size_t aspiration_retries=0, const Score value=Score{}, const Score alpha=Score{}, const Score beta=Score{}, const std::optional< Move > &move=std::nullopt, const SearchPath< Move > *principal_variation=nullptr) |
| template<SearchMove Move> | |
| std::optional< Move > | first_move_of (const SearchPath< Move > &path) |
| template<AdversarialScore Score> | |
| constexpr Score | saturating_subtract (const Score value, const Score delta) noexcept |
| template<AdversarialScore Score> | |
| constexpr Score | saturating_add (const Score value, const Score delta) noexcept |
| template<AdversarialScore Score> | |
| constexpr Score | grow_aspiration_half_window (const Score current, const AspirationWindow< Score > &window) noexcept |
| template<SearchMove Move, AdversarialScore Score, typename State , typename Table , typename Keyer , typename Result > | |
| void | store_adversarial_transposition (State &state, const size_t remaining, Result &result, Table &table, Keyer &keyer, const NodeEvaluation< Move, Score > &value, const TranspositionBound bound, const bool stop) |
| Build an adversarial transposition-table entry and store it. | |
| template<SearchMove Move, AdversarialScore Score, typename State , typename Table , typename Keyer , typename Result > | |
| AdversarialTranspositionEntry< Move, Score > * | probe_and_count_transposition (State &state, const size_t remaining, Result &result, Table &table, Keyer &keyer) |
| Probe a transposition table and update probe/hit/miss statistics. | |
| template<SearchMove Move, AdversarialScore Score, typename Engine , typename Tracer , typename RunOneIteration > requires AdversarialSearchTracer<Tracer, Move, Score> | |
| AdversarialIterativeDeepeningResult< Move, Score > | run_iterative_deepening (Engine &engine, const ExplorationPolicy &policy, const SearchLimits &limits, const AdversarialIterativeDeepeningOptions< Score > &options, Tracer &tracer, RunOneIteration &&run_one_iteration) |
| Core iterative-deepening loop shared by Negamax and Alpha-Beta. | |
|
inlinenoexcept |
Definition at line 554 of file Negamax.H.
References accumulate_search_stats(), accumulate_transposition_stats(), and Aleph::divide_and_conquer_partition_dp().
Referenced by run_iterative_deepening().
|
inlinenoexcept |
Definition at line 516 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp().
Referenced by accumulate_search_stats().
|
inlinenoexcept |
Definition at line 537 of file Negamax.H.
References accumulate_move_ordering_stats(), and Aleph::divide_and_conquer_partition_dp().
Referenced by accumulate_adversarial_stats().
|
inlinenoexcept |
Definition at line 525 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp().
Referenced by accumulate_adversarial_stats().
| void Aleph::adversarial_search_detail::emit_trace | ( | Tracer & | tracer, |
| const AdversarialTraceEventKind | kind, | ||
| const size_t | depth, | ||
| const size_t | remaining, | ||
| const size_t | iteration = 0, |
||
| const size_t | horizon = 0, |
||
| const size_t | aspiration_retries = 0, |
||
| const Score | value = Score{}, |
||
| const Score | alpha = Score{}, |
||
| const Score | beta = Score{}, |
||
| const std::optional< Move > & | move = std::nullopt, |
||
| const SearchPath< Move > * | principal_variation = nullptr |
||
| ) |
Definition at line 565 of file Negamax.H.
Referenced by Aleph::Negamax< Domain >::search_node(), and Aleph::Alpha_Beta< Domain >::search_node().
| auto Aleph::adversarial_search_detail::evaluate_leaf | ( | Domain & | domain, |
| const typename Domain::State & | state, | ||
| Result & | result | ||
| ) |
Definition at line 498 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::adversarial_search_detail::NodeEvaluation< Move, Score >::value.
Referenced by Aleph::Negamax< Domain >::search_node(), and Aleph::Alpha_Beta< Domain >::search_node().
| std::optional< Move > Aleph::adversarial_search_detail::first_move_of | ( | const SearchPath< Move > & | path | ) |
Definition at line 595 of file Negamax.H.
References Aleph::Array< T >::is_empty().
Referenced by run_iterative_deepening(), Aleph::Negamax< Domain >::search_node(), and Aleph::Alpha_Beta< Domain >::search_node().
|
constexprnoexcept |
Definition at line 626 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp(), and saturating_add().
| void Aleph::adversarial_search_detail::mark_limit_reached | ( | Result & | result | ) |
Definition at line 470 of file Negamax.H.
References Aleph::LimitReached.
| SearchPath< Move > Aleph::adversarial_search_detail::prepend_move | ( | const Move & | move, |
| const SearchPath< Move > & | tail | ||
| ) |
Definition at line 480 of file Negamax.H.
References Aleph::Array< T >::append(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().
Referenced by Aleph::Negamax< Domain >::search_node(), and Aleph::Alpha_Beta< Domain >::search_node().
| AdversarialTranspositionEntry< Move, Score > * Aleph::adversarial_search_detail::probe_and_count_transposition | ( | State & | state, |
| const size_t | remaining, | ||
| Result & | result, | ||
| Table & | table, | ||
| Keyer & | keyer | ||
| ) |
Probe a transposition table and update probe/hit/miss statistics.
Returns a pointer to the stored entry on a cache hit, or nullptr on a miss (or when the table is disabled). The caller is responsible for interpreting the bound field and performing any α-β window narrowing.
| Move | Move type. |
| Score | Score type. |
| State | Mutable state type. |
| Table | Transposition-table type (Null or enabled). |
| Keyer | Callable producing a state key. |
| Result | Adversarial result type. |
| state | Mutable state whose key is probed. |
| remaining | Search depth associated with the probe. |
| result | Adversarial result object where stats are updated. |
| table | Transposition table to probe. |
| keyer | Callable that extracts the state key for the table. |
nullptr.
|
inlineconstexprnoexcept |
Definition at line 510 of file Negamax.H.
References Aleph::Search_Unlimited.
Referenced by Aleph::Negamax< Domain >::search_node(), and Aleph::Alpha_Beta< Domain >::search_node().
| AdversarialIterativeDeepeningResult< Move, Score > Aleph::adversarial_search_detail::run_iterative_deepening | ( | Engine & | engine, |
| const ExplorationPolicy & | policy, | ||
| const SearchLimits & | limits, | ||
| const AdversarialIterativeDeepeningOptions< Score > & | options, | ||
| Tracer & | tracer, | ||
| RunOneIteration && | run_one_iteration | ||
| ) |
Core iterative-deepening loop shared by Negamax and Alpha-Beta.
Handles initialization of the result object, the outer depth-stepping loop, per-iteration tracing, stats accumulation, and depth advancement. The engine-specific search call (plain search or aspiration-window search) is delegated to run_one_iteration.
| Move | Move type. |
| Score | Score type. |
| Engine | Negamax<Domain> or Alpha_Beta<Domain>. |
| Tracer | Trace-event sink. |
| RunOneIteration | Callable (out, iteration, depth, iteration_index) -> void. Responsible for executing one depth-limited search attempt (possibly with aspiration retries) and populating iteration.result and iteration.total_stats. |
| engine | Initialized search engine; set_limits is called on it before each iteration. |
| policy | Exploration policy stored into the result. |
| limits | Global search limits (must have a finite max_depth). |
| options | Iterative-deepening options (depth step, initial depth). |
| tracer | Trace sink for Iteration_Begin/Iteration_End events. |
| run_one_iteration | Engine-specific callable for one depth pass. |
Definition at line 761 of file Negamax.H.
References accumulate_adversarial_stats(), Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::aspiration_alpha, Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::aspiration_beta, Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::aspiration_researches, Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::depth, Aleph::divide_and_conquer_partition_dp(), engine, first_move_of(), Aleph::Iteration_Begin, Aleph::Iteration_End, Aleph::SearchLimits::max_depth, options, Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::result, Aleph::AdversarialIterativeDeepeningResult< Move, Score >::result, and Aleph::AdversarialIterativeDeepeningIteration< Move, Score >::total_stats.
|
constexprnoexcept |
Definition at line 615 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp().
Referenced by grow_aspiration_half_window().
|
constexprnoexcept |
Definition at line 604 of file Negamax.H.
References Aleph::divide_and_conquer_partition_dp(), and floor().
|
constexprnoexcept |
|
constexprnoexcept |
| void Aleph::adversarial_search_detail::store_adversarial_transposition | ( | State & | state, |
| const size_t | remaining, | ||
| Result & | result, | ||
| Table & | table, | ||
| Keyer & | keyer, | ||
| const NodeEvaluation< Move, Score > & | value, | ||
| const TranspositionBound | bound, | ||
| const bool | stop | ||
| ) |
Build an adversarial transposition-table entry and store it.
Factored out of Negamax and Alpha_Beta to avoid identical member methods. stop corresponds to the engine's internal early-stop flag.
| Move | Move type. |
| Score | Score type. |
| State | Mutable state type. |
| Table | Transposition-table type (Null or enabled). |
| Keyer | Callable producing a state key. |
| Result | Adversarial result type. |
| state | Mutable game state whose key is stored. |
| remaining | Remaining search depth for the cached entry. |
| result | Adversarial result object where stats are updated. |
| table | Transposition table where the entry is stored. |
| keyer | Callable that extracts the state key for the table. |
| value | Evaluated node to cache. |
| bound | Bound classification for the stored entry. |
| stop | Engine stop flag; no store is performed when true. |
Definition at line 656 of file Negamax.H.
References Aleph::AdversarialTranspositionEntry< Move, Score >::bound, Aleph::AdversarialTranspositionEntry< Move, Score >::depth, Aleph::divide_and_conquer_partition_dp(), Aleph::AdversarialTranspositionEntry< Move, Score >::principal_variation, Aleph::adversarial_search_detail::NodeEvaluation< Move, Score >::principal_variation, Aleph::Rejected, Aleph::Replaced, HashStats< HashTbl >::stats(), Aleph::AdversarialTranspositionEntry< Move, Score >::value, and Aleph::adversarial_search_detail::NodeEvaluation< Move, Score >::value.