npc_engine_core/
config.rs

1/*
2 *  SPDX-License-Identifier: Apache-2.0 OR MIT
3 *  © 2020-2022 ETH Zurich and other contributors, see AUTHORS.txt for details
4 */
5
6use std::num::NonZeroU64;
7
8/// A functor that returns whether the planner must do an early stop.
9pub type EarlyStopCondition = dyn Fn() -> bool + Send;
10
11/// The configuration of an MCTS instance.
12#[derive(Clone, Debug, Default)]
13pub struct MCTSConfiguration {
14    /// if true, invalid tasks do not abort expansion or rollout, but trigger re-planning
15    pub allow_invalid_tasks: bool,
16    /// maximum number of visits per run
17    pub visits: u32,
18    /// maximum tree depth per run in tick
19    pub depth: u32,
20    /// exploration factor to use in UCT to balance exploration and exploitation
21    pub exploration: f32,
22    /// the discount factor for later reward, in half life (per agent's turn or tick)
23    pub discount_hl: f32,
24    /// if not `None`, the duration of the planning task
25    pub planning_task_duration: Option<NonZeroU64>,
26    /// optionally, a user-given seed
27    pub seed: Option<u64>,
28}