lbf/
config.rs

1use jagua_rs::collision_detection::CDEConfig;
2use jagua_rs::geometry::fail_fast::SPSurrogateConfig;
3use jagua_rs::io::svg::SvgDrawOptions;
4use serde::{Deserialize, Serialize};
5
6/// Configuration for the LBF optimizer
7#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
8#[serde(default)]
9pub struct LBFConfig {
10    /// Configuration of the Collision Detection Engine
11    pub cde_config: CDEConfig,
12    /// Max deviation from the original polygon area as a fraction. If undefined, the algorithm will run without simplification
13    pub poly_simpl_tolerance: Option<f32>,
14    /// Minimum distance between items and other hazards.
15    /// If undefined, the algorithm will run without this constraint
16    pub min_item_separation: Option<f32>,
17    /// Seed for the PRNG. If undefined, the algorithm will run in non-deterministic mode using entropy
18    pub prng_seed: Option<u64>,
19    /// Total budget of samples per item per layout
20    pub n_samples: usize,
21    /// Fraction of `n_samples_per_item` used for the local search sampler, the rest is sampled uniformly.
22    pub ls_frac: f32,
23    /// Optional SVG drawing options
24    pub svg_draw_options: SvgDrawOptions,
25}
26
27impl Default for LBFConfig {
28    fn default() -> Self {
29        Self {
30            cde_config: CDEConfig {
31                quadtree_depth: 5,
32                cd_threshold: 16,
33                item_surrogate_config: SPSurrogateConfig {
34                    n_pole_limits: [(100, 0.0), (20, 0.75), (10, 0.90)],
35                    n_ff_poles: 2,
36                    n_ff_piers: 0,
37                },
38            },
39            poly_simpl_tolerance: Some(0.001),
40            min_item_separation: None,
41            prng_seed: None,
42            n_samples: 5000,
43            ls_frac: 0.2,
44            svg_draw_options: SvgDrawOptions::default(),
45        }
46    }
47}