otspot_core/problem/
certificate.rs1#[derive(Debug, Clone)]
6pub struct OptimalCertificate {
7 stationarity_rel: f64,
8 primal_residual_rel: f64,
9 dual_sign_violation: f64,
10 duality_gap_rel: f64,
11 tol: f64,
12}
13
14impl OptimalCertificate {
15 pub(crate) fn new(
16 stationarity_rel: f64,
17 primal_residual_rel: f64,
18 dual_sign_violation: f64,
19 duality_gap_rel: f64,
20 tol: f64,
21 ) -> Self {
22 Self {
23 stationarity_rel,
24 primal_residual_rel,
25 dual_sign_violation,
26 duality_gap_rel,
27 tol,
28 }
29 }
30
31 pub fn stationarity_rel(&self) -> f64 {
33 self.stationarity_rel
34 }
35
36 pub fn primal_residual_rel(&self) -> f64 {
38 self.primal_residual_rel
39 }
40
41 pub fn dual_sign_violation(&self) -> f64 {
43 self.dual_sign_violation
44 }
45
46 pub fn duality_gap_rel(&self) -> f64 {
48 self.duality_gap_rel
49 }
50
51 pub fn tol(&self) -> f64 {
53 self.tol
54 }
55}
56
57#[derive(Debug, Clone)]
59pub struct NotProven {
60 pub stationarity_rel: f64,
61 pub primal_residual_rel: f64,
62 pub bound_violation: f64,
63 pub complementarity_rel: f64,
64 pub dual_sign_violation: f64,
65 pub duality_gap_rel: f64,
66 pub tol: f64,
67 pub failing_conditions: Vec<&'static str>,
68}
69
70#[derive(Debug, Clone)]
74pub struct BoundGapCertificate {
75 incumbent_obj: f64,
76 lower_bound: f64,
77 gap_rel: f64,
78 gap_tol: f64,
79}
80
81impl BoundGapCertificate {
82 pub(crate) fn new(incumbent_obj: f64, lower_bound: f64, gap_rel: f64, gap_tol: f64) -> Self {
83 Self {
84 incumbent_obj,
85 lower_bound,
86 gap_rel,
87 gap_tol,
88 }
89 }
90
91 pub fn incumbent_obj(&self) -> f64 {
93 self.incumbent_obj
94 }
95
96 pub fn lower_bound(&self) -> f64 {
98 self.lower_bound
99 }
100
101 pub fn gap_rel(&self) -> f64 {
103 self.gap_rel
104 }
105
106 pub fn gap_tol(&self) -> f64 {
108 self.gap_tol
109 }
110}