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)]
8pub struct LBFConfig {
9    /// Configuration of the Collision Detection Engine
10    pub cde_config: CDEConfig,
11    /// Max deviation from the original polygon area as a fraction. If undefined, the algorithm will run without simplification
12    pub poly_simpl_tolerance: Option<f32>,
13    /// Minimum distance between items and other hazards.
14    /// If undefined, the algorithm will run without this constraint
15    pub min_item_separation: Option<f32>,
16    /// Seed for the PRNG. If undefined, the algorithm will run in non-deterministic mode using entropy
17    pub prng_seed: Option<u64>,
18    /// Total budget of samples per item per layout
19    pub n_samples: usize,
20    /// Fraction of `n_samples_per_item` used for the local search sampler, the rest is sampled uniformly.
21    pub ls_frac: f32,
22    /// Optional SVG drawing options
23    #[serde(default)]
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                item_surrogate_config: SPSurrogateConfig {
33                    n_pole_limits: [(100, 0.0), (20, 0.75), (10, 0.90)],
34                    n_ff_poles: 2,
35                    n_ff_piers: 0,
36                },
37            },
38            poly_simpl_tolerance: Some(0.001),
39            min_item_separation: None,
40            prng_seed: Some(0),
41            n_samples: 5000,
42            ls_frac: 0.2,
43            svg_draw_options: SvgDrawOptions::default(),
44        }
45    }
46}