1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, Serialize, Deserialize)]
4pub struct Params {
6 pub tol: f64,
8 pub max_steps: usize,
10 pub verbose: usize,
12 pub time_limit: f64,
14 pub sigma: f64,
16 pub eta: f64,
18 pub max_back_steps: usize,
20}
21
22impl Params {
23 pub fn new() -> Self {
25 Params {
26 tol: 1e-8,
27 max_steps: usize::MAX,
28 verbose: 0,
29 time_limit: f64::INFINITY,
30 sigma: 0.001,
31 eta: 0.1,
32 max_back_steps: 8,
33 }
34 }
35
36 pub fn with_verbose(mut self, verbose: usize) -> Self {
38 self.verbose = verbose;
39 self
40 }
41
42 pub fn with_tol(mut self, tol: f64) -> Self {
44 self.tol = tol;
45 self
46 }
47
48 pub fn with_time_limit(mut self, time_limit: f64) -> Self {
50 self.time_limit = time_limit;
51 self
52 }
53
54 pub fn with_max_steps(mut self, max_steps: usize) -> Self {
56 self.max_steps = max_steps;
57 self
58 }
59}