Reaktoro
A unified framework for modeling chemically reactive systems
OptimumOptions.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Common/Outputter.hpp>
22 #include <Reaktoro/Math/LU.hpp>
23 #include <Reaktoro/Optimization/KktSolver.hpp>
24 #include <Reaktoro/Optimization/Regularizer.hpp>
25 
26 namespace Reaktoro {
27 
30 {
33 
36 };
37 
39 {
41  double threshold = 1.0e-14;
42 };
43 
45 {
47  double mu = 1.0e-20;
48 
53  double tau = 0.99;
54 
57 };
58 
60 {
62  double mu = 1.0e-20;
63 
68  double tau = 0.99;
69 
72 };
73 
75 {
78  double epsilon = 1e-20;
79 
83  double tau = 1e-5;
84 };
85 
87 {
89  std::vector<double> mu = std::vector<double>({1e-8, 1e-16}); // need explicit initialization list to compile in MSVC 2013
90 
91  double delta = 1.0;
92  double eta_phi = 1.0e-4;
93  double gamma_alpha = 0.05;
94  double gamma_phi = 1.0e-5;
95  double gamma_theta = 1.0e-5;
96  double kappa_epsilon = 10.0;
97  double kappa_mu = 0.2;
98  double kappa_sigma = 1.0e+10;
99  double kappa_soc = 0.99;
100  double s_phi = 2.3;
101  double s_theta = 1.1;
102  double tau_min = 0.9999;
103  double theta_mu = 2.0;
104  unsigned max_iters_soc = 4;
105  bool soc = true;
106 
108  double mux = 1.0e-5;
109 
111  bool scaling = true;
112 };
113 
115 {
118 
120  double line_search_wolfe = 1.0e-4;
121 
122  // The fraction-to-the-boundary factor used in the feasible step
123  double tau_feasible = 0.99;
124 
125  // The fraction-to-the-boundary factor used in the descent step
126  double tau_descent = 0.9999;
127 
129  double feasibility_tolerance = 1.0e-13;
130 
132  double negative_dual_tolerance = -1.0e-2;
133 
136  double active_to_inactive = 1.0e-6;
137 
139  bool use_kkt_solver = false;
140 };
141 
143 {
144  bool use_lma_setup = true;
145 };
146 
149 {
151  std::string xprefix = "x";
152 
154  std::string yprefix = "y";
155 
157  std::string zprefix = "z";
158 
161  std::vector<std::string> xnames;
162 
165  std::vector<std::string> ynames;
166 
169  std::vector<std::string> znames;
170 
172  auto operator=(bool active) -> OptimumOutputOptions&;
173 };
174 
177 {
179  double delta = 0.0;
180 
182  double gamma = 0.0;
183 };
184 
187 {
189  double tolerance = 1.0e-6;
190 
195  double tolerancex = 0.0;
196 
201  double tolerancef = 0.0;
202 
205 
207  unsigned max_iterations = 200;
208 
211 
214 
217 
220 
223 
226 
229 
232 
235 
238 };
239 
240 } // namespace Reaktoro
auto operator=(bool active) -> OptimumOutputOptions &
Assign a boolean value to active member.
Definition: OptimumOptions.cpp:22
Definition: OptimumOptions.hpp:87
A type that describes the options for the output of a optimisation calculation.
Definition: OptimumOptions.hpp:149
unsigned max_iterations
The maximum number of iterations in the optimisation calculations.
Definition: OptimumOptions.hpp:207
OptimumParamsIpOpt ipopt
The parameters for the IpOpt algorithm.
Definition: OptimumOptions.hpp:219
double tau
The fraction-to-the boundary parameter to relax the line-search backtracking step.
Definition: OptimumOptions.hpp:68
bool use_kkt_solver
The flag that indicates if KktSolver should be used to solve the linear systems.
Definition: OptimumOptions.hpp:139
double line_search_wolfe
The constant for the Wolfe condition of sufficient decrease in the backtracking line search step.
Definition: OptimumOptions.hpp:120
StepMode step
The step mode for the Newton updates.
Definition: OptimumOptions.hpp:71
double mux
The factor used to correct the primal initial guess that are too small or on the boundary.
Definition: OptimumOptions.hpp:108
OptimumParamsRefiner refiner
The parameters for the Refiner algorithm.
Definition: OptimumOptions.hpp:231
double tau
The factor τ for the barrier parameter μ defined here as μ = ετ.
Definition: OptimumOptions.hpp:83
std::vector< std::string > ynames
The names of the dual variables y.
Definition: OptimumOptions.hpp:165
Definition: OptimumOptions.hpp:39
KktOptions kkt
The options for the KKT calculations.
Definition: OptimumOptions.hpp:237
double tolerancex
The tolerance for the variation in primal variables x.
Definition: OptimumOptions.hpp:195
Definition: OptimumOptions.hpp:45
@ Conservative
Use convervative step in which its direction is not changed.
Definition: OptimumOptions.hpp:32
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
bool scaling
The flag that indicates if the KKT problems should be scaled with the matrix sqrt(diag(x))
Definition: OptimumOptions.hpp:111
OptimumParamsActNewton actnewton
The parameters for the ActNewton algorithm.
Definition: OptimumOptions.hpp:213
std::string yprefix
The prefix for the dual variables y.
Definition: OptimumOptions.hpp:154
double feasibility_tolerance
The tolerance for the feasibility problem.
Definition: OptimumOptions.hpp:129
double gamma
The regularization parameter for bounded solutions.
Definition: OptimumOptions.hpp:182
double active_to_inactive
The value used to remove a primal variable from an active state (i.e., a variable on the bound) to an...
Definition: OptimumOptions.hpp:136
A type to describe the options for the KKT calculation.
Definition: KktSolver.hpp:72
OptimumParamsIpAction ipaction
The parameters for the IpAction algorithm.
Definition: OptimumOptions.hpp:216
A type that describes the regularization options for the optimisation calculation.
Definition: OptimumOptions.hpp:177
OptimumParamsKarpov karpov
The parameters for the Karpov algorithm.
Definition: OptimumOptions.hpp:228
A type that describes the options of a optimisation calculation.
Definition: OptimumOptions.hpp:187
std::vector< std::string > znames
The names of the dual variables z.
Definition: OptimumOptions.hpp:169
double threshold
The threshold for which primal variables lower than it is updated explicitly.
Definition: OptimumOptions.hpp:41
std::vector< std::string > xnames
The names of the primal variables x.
Definition: OptimumOptions.hpp:161
Definition: OptimumOptions.hpp:143
double negative_dual_tolerance
The tolerance for the negative dual variables z.
Definition: OptimumOptions.hpp:132
StepMode
The available stepping modes for some optimization algorithms.
Definition: OptimumOptions.hpp:30
std::string xprefix
The prefix for the primal variables x.
Definition: OptimumOptions.hpp:151
StepMode step
The step mode for the Newton updates.
Definition: OptimumOptions.hpp:56
double delta
The regularization parameter of the linear equality constraints.
Definition: OptimumOptions.hpp:179
A type that describes the options for regularizing linear constraints.
Definition: Regularizer.hpp:35
Definition: OptimumOptions.hpp:115
Definition: OptimumOptions.hpp:60
std::string zprefix
The prefix for the dual variables z.
Definition: OptimumOptions.hpp:157
double epsilon
The parameter ε for the numerical representation of a zero.
Definition: OptimumOptions.hpp:78
OptimumParamsIpNewton ipnewton
The parameters for the IpNewton algorithm.
Definition: OptimumOptions.hpp:222
OptimumParamsIpActive ipactive
The parameters for the IpActive algorithm.
Definition: OptimumOptions.hpp:225
double tolerance
The tolerance for the residual of the optimality conditions.
Definition: OptimumOptions.hpp:189
std::vector< double > mu
The interior-point perturbation parameters (default: {1e-8, 1e-16})
Definition: OptimumOptions.hpp:89
double tau
The fraction-to-the boundary parameter to relax the line-search backtracking step.
Definition: OptimumOptions.hpp:53
Definition: Outputter.hpp:32
double line_search_max_iterations
The maximum number of iterations for the line search minimization problem.
Definition: OptimumOptions.hpp:117
@ Aggressive
Use aggressive step that results in faster approach of variables to the bounds.
Definition: OptimumOptions.hpp:35
Definition: OptimumOptions.hpp:75
OptimumOutputOptions output
The options for the output of the optimisation calculations.
Definition: OptimumOptions.hpp:210
double tolerancef
The tolerance for the variation in objective value.
Definition: OptimumOptions.hpp:201
double mu
The perturbation parameter (or barrier parameter) for the interior-point method.
Definition: OptimumOptions.hpp:47
double tolerance_linear_constraints
The tolerance for the linear contraint equations.
Definition: OptimumOptions.hpp:204
OptimumParamsRegularization regularization
The regularization options for the optimisation calculation.
Definition: OptimumOptions.hpp:234
double mu
The perturbation parameter (or barrier parameter) for the interior-point method.
Definition: OptimumOptions.hpp:62