1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/// Lagrange and Kuhn-Tucker multipliers on the constraints.
pub struct Lambda {
/// Multipliers on the equality constraints.
pub eq_non_lin: Vec<f64>,
/// Multipliers on the inequality constraints.
pub ineq_non_lin: Vec<f64>,
/// Lower (left-hand) limit on linear constraints.
pub mu_l: Vec<f64>,
/// Upper (right-hand) limit on linear constraints.
pub mu_u: Vec<f64>,
/// Lower bound on optimization variables.
pub lower: Vec<f64>,
/// Upper bound on optimization variables.
pub upper: Vec<f64>,
}
impl Default for Lambda {
fn default() -> Self {
Self {
eq_non_lin: Vec::new(),
ineq_non_lin: Vec::new(),
mu_l: Vec::new(),
mu_u: Vec::new(),
lower: Vec::new(),
upper: Vec::new(),
}
}
}
pub struct Options {
/// Termination tolerance for feasibility condition.
pub feas_tol: f64,
/// Termination tolerance for gradient condition.
pub grad_tol: f64,
/// Termination tolerance for complementarity condition.
pub comp_tol: f64,
/// Termination tolerance for cost condition.
pub cost_tol: f64,
/// Maximum number of iterations.
pub max_it: usize,
/// Set to enable step-size control.
#[cfg(feature = "step-control")]
pub step_control: bool,
/// Maximum number of step-size reductions if step-control is on.
#[cfg(feature = "step-control")]
pub max_red: usize,
/// Cost multiplier used to scale the objective function for improved
/// conditioning.
///
/// Note: This value is also passed as the 3rd argument to the Hessian
/// evaluation function so that it can appropriately scale the objective
/// function term in the Hessian of the Lagrangian.
pub cost_mult: f64,
/// Constant used in alpha updates.
pub xi: f64,
/// Centering parameter.
pub sigma: f64,
/// Used to initialize slack variables.
pub z0: f64,
/// Exits if either alpha parameter becomes smaller than this value.
pub alpha_min: f64,
/// Lower bound on rho_t.
#[cfg(feature = "step-control")]
pub rho_min: f64,
/// Upper bound on rho_t.
#[cfg(feature = "step-control")]
pub rho_max: f64,
/// KT multipliers smaller than this value for non-binding constraints are forced to zero.
pub mu_threshold: f64,
/// Exits if the 2-norm of the reduced Newton step exceeds this value.
pub max_step_size: f64,
}
impl Default for Options {
fn default() -> Self {
Self {
feas_tol: 1e-6,
grad_tol: 1e-6,
comp_tol: 1e-6,
cost_tol: 1e-6,
max_it: 150,
#[cfg(feature = "step-control")]
step_control: false,
#[cfg(feature = "step-control")]
max_red: 20,
cost_mult: 1.0,
xi: 0.99995,
sigma: 0.1,
z0: 1.0,
alpha_min: 1e-8,
#[cfg(feature = "step-control")]
rho_min: 0.95,
#[cfg(feature = "step-control")]
rho_max: 1.05,
mu_threshold: 1e-5,
max_step_size: 1e10,
}
}
}