pub struct SolverConfig {
pub environment_mode: EnvironmentMode,
pub random_seed: Option<u64>,
pub move_thread_count: MoveThreadCount,
pub termination: Option<TerminationConfig>,
pub score_director: Option<DirectorConfig>,
pub phases: Vec<PhaseConfig>,
pub candidate_trace: Option<CandidateTraceConfig>,
}Fields§
§environment_mode: EnvironmentMode§random_seed: Option<u64>§move_thread_count: MoveThreadCount§termination: Option<TerminationConfig>§score_director: Option<DirectorConfig>§phases: Vec<PhaseConfig>§candidate_trace: Option<CandidateTraceConfig>Optional bounded candidate-pull trace for cross-runtime diagnostics.
This is deliberately opt-in: recording a trace retains one owned identity per engine-consumed candidate. A non-zero cap is required so diagnostic runs cannot accidentally retain an unbounded neighborhood.
Implementations§
Source§impl SolverConfig
impl SolverConfig
pub fn new() -> Self
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, ConfigError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, ConfigError>
Loads configuration from a TOML file.
§Errors
Returns error if file doesn’t exist or contains invalid TOML.
Sourcepub fn from_toml_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
pub fn from_toml_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
Loads configuration from a TOML file.
Sourcepub fn from_toml_str(s: &str) -> Result<Self, ConfigError>
pub fn from_toml_str(s: &str) -> Result<Self, ConfigError>
Parses configuration from a TOML string.
Sourcepub fn from_yaml_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
pub fn from_yaml_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
Loads configuration from a YAML file.
Sourcepub fn from_yaml_str(s: &str) -> Result<Self, ConfigError>
pub fn from_yaml_str(s: &str) -> Result<Self, ConfigError>
Parses configuration from a YAML string.
pub fn with_termination_seconds(self, seconds: u64) -> Self
pub fn with_random_seed(self, seed: u64) -> Self
pub fn with_phase(self, phase: PhaseConfig) -> Self
Sourcepub fn canonical_toml(&self) -> String
pub fn canonical_toml(&self) -> String
Returns a deterministic, complete representation of this effective configuration for diagnostic provenance.
The representation is intentionally produced by the same serde model used to load solver configuration. Consumers compare this exact value together with the resolved phase plan in the candidate trace header.
Sourcepub fn canonical_phase_toml(phase: &PhaseConfig) -> String
pub fn canonical_phase_toml(phase: &PhaseConfig) -> String
Returns the canonical solver-document representation of one phase.
Runtime provenance uses this rather than debug formatting so every configured selector, acceptor, forager, target, and termination field participates in the candidate-trace plan digest.
Sourcepub fn time_limit(&self) -> Option<Duration>
pub fn time_limit(&self) -> Option<Duration>
Returns the termination time limit, if configured.
Convenience method that delegates to termination.time_limit().
§Examples
use solverforge_config::SolverConfig;
use std::time::Duration;
let config = SolverConfig::from_toml_str(r#"
[termination]
seconds_spent_limit = 30
"#).unwrap();
assert_eq!(config.time_limit(), Some(Duration::from_secs(30)));Trait Implementations§
Source§impl Clone for SolverConfig
impl Clone for SolverConfig
Source§fn clone(&self) -> SolverConfig
fn clone(&self) -> SolverConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more