Reaktoro 
A unified framework for modeling chemically reactive systems
Regularizer.hpp
1 // Reaktoro is a C++ library for computational reaction modelling.
2 //
3 // Copyright (C) 2014 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <memory>
22 
23 // Reaktoro includes
24 #include <Reaktoro/Math/Matrix.hpp>
25 
26 namespace Reaktoro {
27 
29 struct OptimumOptions;
30 struct OptimumProblem;
31 struct OptimumState;
32 
35 {
39  bool echelonize = true;
40 
46  unsigned max_denominator = 0;
47 };
48 
51 {
52 public:
54  Regularizer();
55 
57  Regularizer(const Regularizer& other);
58 
60  virtual ~Regularizer();
61 
63  auto operator=(Regularizer other) -> Regularizer&;
64 
66  auto setOptions(const RegularizerOptions& options) -> void;
67 
72  auto regularize(OptimumProblem& problem, OptimumState& state, OptimumOptions& options) -> void;
73 
75  auto regularize(Vector& dgdp, Vector& dbdp) -> void;
76 
79  auto recover(OptimumState& state) -> void;
80 
82  auto recover(Vector& dxdp) -> void;
83 
84 private:
85  struct Impl;
86 
87  std::unique_ptr<Impl> pimpl;
88 };
89 
90 } // namespace Reaktoro
A type that describes the non-linear constrained optimisation problem.
Definition: OptimumProblem.hpp:48
bool echelonize
The boolean flag that indicates if echelonization should be performed.
Definition: Regularizer.hpp:39
A type that represents a regularized optimization problem.
Definition: Regularizer.hpp:50
unsigned max_denominator
The maximum denominator that can exist in the coefficient matrix A.
Definition: Regularizer.hpp:46
Eigen::VectorXd Vector
Define an alias to the vector type of the Eigen library.
Definition: Matrix.hpp:384
A type that describes the options of a optimisation calculation.
Definition: OptimumOptions.hpp:186
A type that describes the options for regularizing linear constraints.
Definition: Regularizer.hpp:34
A type that describes the state of an optimum solution.
Definition: OptimumState.hpp:28
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24