Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
SmartEquilibriumResult.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 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/Types.hpp>
22 #include <Reaktoro/Equilibrium/EquilibriumResult.hpp>
23 
24 namespace Reaktoro {
25 
28 {
30  double solve = 0.0;
31 
33  double learning = 0.0;
34 
36  double learning_solve = 0.0;
37 
40 
43 
46 
48  double learning_storage = 0.0;
49 
51  double prediction = 0.0;
52 
54  double prediction_search = 0.0;
55 
58 
60  double prediction_taylor = 0.0;
61 
64 
67 };
68 
72 {
74  bool accepted = false;
75 
78 
81 
84 
85  // Self addition assignment to accumulate results.
87 };
88 
92 {
95 
98 };
99 
102 {
104  auto succeeded() { return prediction.accepted ? true : learning.solve.succeeded(); };
105 
107  auto failed() { return !succeeded(); };
108 
110  auto predicted() { return prediction.accepted; };
111 
113  auto learned() { return !prediction.accepted; };
114 
117 
120 
123 
126 
129 };
130 
131 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
A type used to describe the result of an equilibrium calculation.
Definition: EquilibriumResult.hpp:28
auto iterations() const
Return the number of iterations in the calculation.
Definition: EquilibriumResult.hpp:36
auto succeeded() const
Return true if the calculation succeeded.
Definition: EquilibriumResult.hpp:30
Used to represent the result of a learning operation in a smart chemical equilibrium calculation.
Definition: SmartEquilibriumResult.hpp:92
auto operator+=(const SmartEquilibriumResultDuringLearning &other) -> SmartEquilibriumResultDuringLearning &
Self addition assignment to accumulate results.
EquilibriumResult solve
The result of the conventional iterative chemical equilibrium calculation in the learning operation.
Definition: SmartEquilibriumResult.hpp:94
Used to represent the result of a prediction operation in a smart chemical equilibrium calculation.
Definition: SmartEquilibriumResult.hpp:72
double failed_with_amount
The amount of the species that caused the smart approximation to fail.
Definition: SmartEquilibriumResult.hpp:80
double failed_with_chemical_potential
The amount of the species that caused the smart approximation to fail.
Definition: SmartEquilibriumResult.hpp:83
String failed_with_species
The name of the species that caused the smart approximation to fail.
Definition: SmartEquilibriumResult.hpp:77
bool accepted
The indication whether the smart equilibrium prediction was accepted.
Definition: SmartEquilibriumResult.hpp:74
Used to describe the result of a smart chemical equilibrium calculation.
Definition: SmartEquilibriumResult.hpp:102
auto predicted()
Return true if the calculation was performed using a fast first-order Taylor prediction.
Definition: SmartEquilibriumResult.hpp:110
SmartEquilibriumTiming timing
The timing information of the operations during a smart chemical equilibrium calculation.
Definition: SmartEquilibriumResult.hpp:125
auto succeeded()
Return true if the calculation succeeded.
Definition: SmartEquilibriumResult.hpp:104
auto failed()
Return true if the calculation failed.
Definition: SmartEquilibriumResult.hpp:107
SmartEquilibriumResultDuringLearning learning
The result of the learning operation (if there was learning).
Definition: SmartEquilibriumResult.hpp:122
SmartEquilibriumResultDuringPrediction prediction
The result of the smart approximation operation.
Definition: SmartEquilibriumResult.hpp:116
auto operator+=(const SmartEquilibriumResult &other) -> SmartEquilibriumResult &
Self addition assignment to accumulate results.
auto learned()
Return true if the calculation was learned, not predicted, and performed using the conventional algor...
Definition: SmartEquilibriumResult.hpp:113
auto iterations()
Return the number of iterations in the calculation (zero if prediction was successful).
Definition: SmartEquilibriumResult.hpp:116
Used to provide timing information of the operations during a smart chemical equilibrium calculation.
Definition: SmartEquilibriumResult.hpp:28
double prediction_taylor
The time spent for the matrix-vector multiplication during a smart prediction (in seconds).
Definition: SmartEquilibriumResult.hpp:60
double prediction_priority_update
The time spent for updating the priority related info of the clusters in the database (in seconds).
Definition: SmartEquilibriumResult.hpp:63
double learning_sensitivity_matrix
The time spent for computing the sensitivity matrix during the learning operation (in seconds).
Definition: SmartEquilibriumResult.hpp:42
double prediction_search
The time spent for the search operation during a smart prediction (in seconds).
Definition: SmartEquilibriumResult.hpp:54
double learning_error_control_matrices
The time spent for computing the error control matrices during the learning operation (in seconds).
Definition: SmartEquilibriumResult.hpp:45
double solve
The time spent for solving the chemical equilibrium problem (in seconds).
Definition: SmartEquilibriumResult.hpp:30
double prediction_error_control
The time spent during on error control while searching during a smart prediction (in seconds).
Definition: SmartEquilibriumResult.hpp:57
double learning
The time spent for learning a new chemical equilibrium state (in seconds).
Definition: SmartEquilibriumResult.hpp:33
double learning_storage
The time spent for storing the computed chemical state into the tree of knowledge (in seconds).
Definition: SmartEquilibriumResult.hpp:48
auto operator+=(const SmartEquilibriumTiming &other) -> SmartEquilibriumTiming &
Self addition of another SmartEquilibriumTiming instance to this one.
double prediction
The time spent for the smart chemical equilibrium state prediction (in seconds).
Definition: SmartEquilibriumResult.hpp:51
double learning_chemical_properties
The time spent for computing the chemical properties during the learning operation (in seconds).
Definition: SmartEquilibriumResult.hpp:39
double learning_solve
The time spent for a conventional iterative chemical equilibrium calculation during the learning oper...
Definition: SmartEquilibriumResult.hpp:36