Skip to main content

solverforge_config/
forager.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, PartialEq, Eq)]
4#[serde(rename_all = "snake_case")]
5pub enum ScoreTieBreak {
6    #[default]
7    Random,
8    First,
9}
10
11// Forager configuration.
12#[derive(Debug, Clone, Deserialize, Serialize)]
13#[serde(tag = "type", rename_all = "snake_case")]
14pub enum ForagerConfig {
15    // Stop after N accepted candidates and pick the best among them.
16    AcceptedCount(AcceptedCountForagerConfig),
17
18    // Evaluate the full neighborhood and pick the best accepted move.
19    BestScore,
20
21    // Pick the first accepted move.
22    FirstAccepted,
23
24    // Stop on the first move improving the phase-best score.
25    FirstBestScoreImproving,
26
27    // Stop on the first move improving the previous step score.
28    FirstLastStepScoreImproving,
29}
30
31// Accepted-count forager configuration.
32#[derive(Debug, Clone, Default, Deserialize, Serialize)]
33#[serde(rename_all = "snake_case")]
34pub struct AcceptedCountForagerConfig {
35    pub limit: Option<usize>,
36}