OpenNN
2.2
Open Neural Networks Library
|
#include <conditions_layer.h>
Public Types | |
enum | ConditionsMethod { NoConditions, OneCondition, TwoConditions, UserConditionsMethod } |
Public Member Functions | |
ConditionsLayer (void) | |
ConditionsLayer (const size_t &, const size_t &) | |
ConditionsLayer (const tinyxml2::XMLDocument &) | |
ConditionsLayer (const ConditionsLayer &) | |
virtual | ~ConditionsLayer (void) |
ConditionsLayer & | operator= (const ConditionsLayer &) |
bool | operator== (const ConditionsLayer &) const |
const size_t & | get_external_inputs_number (void) const |
const size_t & | get_conditions_neurons_number (void) const |
const ConditionsMethod & | get_conditions_method (void) const |
std::string | write_conditions_method (void) const |
const Vector< double > & | get_external_input_values (void) const |
const double & | get_external_input_value (const size_t &) const |
const Matrix< double > & | get_output_values (void) const |
const double & | get_output_value (const size_t &, const size_t &) const |
const bool & | get_display (void) const |
void | set (void) |
void | set (const size_t &, const size_t &) |
void | set (const ConditionsLayer &) |
void | set_external_inputs_number (const size_t &) |
void | set_conditions_neurons_number (const size_t &) |
void | set_conditions_method (const ConditionsMethod &) |
void | set_conditions_method (const std::string &) |
void | set_external_input_values (const Vector< double > &) |
void | set_external_input_value (const size_t &, const double &) |
void | set_output_values (const Matrix< double > &) |
void | set_output_value (const size_t &, const size_t &, const double &) |
void | set_display (const bool &) |
void | set_default (void) |
void | initialize_random (void) |
void | check (void) const |
virtual Vector< double > | calculate_particular_solution (const Vector< double > &) const |
virtual Matrix< double > | calculate_particular_solution_Jacobian (const Vector< double > &) const |
virtual Vector< Matrix< double > > | calculate_particular_solution_Hessian_form (const Vector< double > &) const |
virtual Vector< double > | calculate_homogeneous_solution (const Vector< double > &) const |
virtual Matrix< double > | calculate_homogeneous_solution_Jacobian (const Vector< double > &) const |
virtual Vector< Matrix< double > > | calculate_homogeneous_solution_Hessian_form (const Vector< double > &) const |
Vector< double > | calculate_outputs (const Vector< double > &, const Vector< double > &) const |
Matrix< double > | calculate_Jacobian (const Vector< double > &, const Vector< double > &, const Matrix< double > &) const |
Vector< Matrix< double > > | calculate_Hessian_form (const Vector< double > &, const Vector< double > &) const |
Vector< double > | calculate_one_condition_particular_solution (const Vector< double > &) const |
Matrix< double > | calculate_one_condition_particular_solution_Jacobian (const Vector< double > &) const |
Vector< Matrix< double > > | calculate_one_condition_particular_solution_Hessian_form (const Vector< double > &) const |
Vector< double > | calculate_one_condition_homogeneous_solution (const Vector< double > &) const |
Matrix< double > | calculate_one_condition_homogeneous_solution_Jacobian (const Vector< double > &) const |
Vector< Matrix< double > > | calculate_one_condition_homogeneous_solution_Hessian_form (const Vector< double > &) const |
Vector< double > | calculate_two_conditions_particular_solution (const Vector< double > &) const |
Matrix< double > | calculate_two_conditions_particular_solution_Jacobian (const Vector< double > &) const |
Vector< Matrix< double > > | calculate_two_conditions_particular_solution_Hessian_form (const Vector< double > &) const |
Vector< double > | calculate_two_conditions_homogeneous_solution (const Vector< double > &) const |
Matrix< double > | calculate_two_conditions_homogeneous_solution_Jacobian (const Vector< double > &) const |
Vector< Matrix< double > > | calculate_two_conditions_homogeneous_solution_Hessian_form (const Vector< double > &) const |
virtual std::string | write_particular_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
virtual std::string | write_homogeneous_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_one_condition_particular_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_one_condition_homogeneous_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_two_conditions_particular_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_two_conditions_homogeneous_solution_expression (const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_output_expression (const Vector< std::string > &, const Vector< std::string > &, const Vector< std::string > &, const Vector< std::string > &) const |
std::string | write_expression (const Vector< std::string > &, const Vector< std::string > &, const Vector< std::string > &) const |
std::string | to_string (void) const |
tinyxml2::XMLDocument * | to_XML (void) const |
void | from_XML (const tinyxml2::XMLDocument &) |
Protected Attributes | |
size_t | external_inputs_number |
size_t | conditions_neurons_number |
ConditionsMethod | conditions_method |
Vector< double > | external_input_values |
Matrix< double > | output_values |
bool | display |
This class represents a layer of conditions. Conditions are used to ensure that given outputs are provided for given inputs. Note that this is quite a difficult topic in the field of neural networks.
Definition at line 42 of file conditions_layer.h.
|
explicit |
Default constructor. It creates a conditions layer object.
Definition at line 26 of file conditions_layer.cpp.
|
explicit |
Inputs and outputs number constructor.
new_inputs_number | Number of inputs. |
new_conditions_neurons_number | Number of conditions neurons. |
Definition at line 40 of file conditions_layer.cpp.
|
explicit |
XML constructor.
conditions_layer_document | Pointer to a TinyXML document with the member data. |
Definition at line 53 of file conditions_layer.cpp.
OpenNN::ConditionsLayer::ConditionsLayer | ( | const ConditionsLayer & | other_conditions_layer | ) |
Copy constructor.
other_conditions_layer | Conditions layer object to be copied. |
Definition at line 66 of file conditions_layer.cpp.
Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_Hessian_form | ( | const Vector< double > & | , |
const Vector< double > & | |||
) | const |
Definition at line 785 of file conditions_layer.cpp.
|
virtual |
Returns the homogeneous solution for applying boundary conditions.
Returns the homogeneous solution values for applying conditions.
external_inputs | Vector of external inputs. |
Definition at line 645 of file conditions_layer.cpp.
|
virtual |
Returns the Hessian form of the homogeneous solution function.
external_inputs | Vector of external inputs. |
Definition at line 717 of file conditions_layer.cpp.
|
virtual |
Returns the homogeneous solution Jacobian for applying boundary conditions.
Returns the homogeneous solution Jacobian for applying conditions.
external_inputs | Vector of external inputs. |
Definition at line 681 of file conditions_layer.cpp.
Matrix< double > OpenNN::ConditionsLayer::calculate_Jacobian | ( | const Vector< double > & | external_inputs, |
const Vector< double > & | outputs, | ||
const Matrix< double > & | Jacobian | ||
) | const |
Calculates the partial derivatives of the outputs satisfying some boundary conditions with respect to the raw outputs.
external_inputs | Vector of external inputs. |
outputs | Vector of outputs from the conditions layer. |
Jacobian | Partial derivatives of the raw outputs with respect to the inputs. |
Definition at line 770 of file conditions_layer.cpp.
Vector< double > OpenNN::ConditionsLayer::calculate_one_condition_homogeneous_solution | ( | const Vector< double > & | external_inputs | ) | const |
Computes the homogeneous solution for the one boundary condition case.
external_inputs | Vector of external inputs. |
Definition at line 854 of file conditions_layer.cpp.
Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_one_condition_homogeneous_solution_Hessian_form | ( | const Vector< double > & | ) | const |
Computes the homogeneous solution Hessian form for the one boundary condition case.
Definition at line 892 of file conditions_layer.cpp.
Vector< double > OpenNN::ConditionsLayer::calculate_one_condition_particular_solution | ( | const Vector< double > & | external_inputs | ) | const |
Computes the particular solution for the one boundary condition case.
external_inputs | Vector of external inputs. |
Definition at line 798 of file conditions_layer.cpp.
Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_one_condition_particular_solution_Hessian_form | ( | const Vector< double > & | ) | const |
Computes the Hessian form of the particular solution function for the one boundary condition case.
Definition at line 835 of file conditions_layer.cpp.
Vector< double > OpenNN::ConditionsLayer::calculate_outputs | ( | const Vector< double > & | external_inputs, |
const Vector< double > & | inputs | ||
) | const |
Returns the outputs satisfying the conditions defined by the particular and homogeneous solutions.
Definition at line 754 of file conditions_layer.cpp.
|
virtual |
Returns the particular solution for applying boundary conditions.
Returns the particular solution function for applying conditions.
external_inputs | Vector of external inputs. |
Definition at line 537 of file conditions_layer.cpp.
|
virtual |
Returns the Hessian form of the particular solution.
external_inputs | Vector of external inputs. |
Definition at line 609 of file conditions_layer.cpp.
|
virtual |
Returns the particular solution Jacobian for applying boundary conditions.
Returns the particular solution Jacobian for applying conditions.
external_inputs | Vector of external inputs. |
Definition at line 573 of file conditions_layer.cpp.
Vector< double > OpenNN::ConditionsLayer::calculate_two_conditions_homogeneous_solution | ( | const Vector< double > & | external_inputs | ) | const |
Computes the homogeneous solution for the two boundary conditions case.
external_inputs | Vector of external inputs. |
Definition at line 1020 of file conditions_layer.cpp.
Matrix< double > OpenNN::ConditionsLayer::calculate_two_conditions_homogeneous_solution_Jacobian | ( | const Vector< double > & | external_inputs | ) | const |
Computes the homogeneous solution Jacobian for the two boundary conditions case.
external_inputs | Vector of external inputs. |
Definition at line 1059 of file conditions_layer.cpp.
Vector< double > OpenNN::ConditionsLayer::calculate_two_conditions_particular_solution | ( | const Vector< double > & | external_inputs | ) | const |
Computes the particular solution for the two boundary conditions case.
external_inputs | Vector of external inputs. |
Definition at line 911 of file conditions_layer.cpp.
Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_two_conditions_particular_solution_Hessian_form | ( | const Vector< double > & | ) | const |
Computes the particular solution Hessian form for the two boundary conditions case.
Definition at line 1001 of file conditions_layer.cpp.
Matrix< double > OpenNN::ConditionsLayer::calculate_two_conditions_particular_solution_Jacobian | ( | const Vector< double > & | ) | const |
Computes the particular solution Jacobian for the two boundary conditions case.
Definition at line 961 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::from_XML | ( | const tinyxml2::XMLDocument & | document | ) |
Deserializes a TinyXML document into this conditions layer object.
document | TinyXML document containing the member data. |
Definition at line 1453 of file conditions_layer.cpp.
const ConditionsLayer::ConditionsMethod & OpenNN::ConditionsLayer::get_conditions_method | ( | void | ) | const |
Returns the method for calculating the conditions. Avaliable methods include one conditions, two conditions or user defined conditions.
Definition at line 157 of file conditions_layer.cpp.
const bool & OpenNN::ConditionsLayer::get_display | ( | void | ) | const |
Returns true if messages from this class are to be displayed on the screen, or false if messages from this class are not to be displayed on the screen.
Definition at line 239 of file conditions_layer.cpp.
const double & OpenNN::ConditionsLayer::get_external_input_value | ( | const size_t & | i | ) | const |
Returns a single input value for the conditions.
i | Index of condition. |
Definition at line 206 of file conditions_layer.cpp.
const double & OpenNN::ConditionsLayer::get_output_value | ( | const size_t & | i, |
const size_t & | j | ||
) | const |
Returns a single output value for the conditions.
i | Index of output. |
j | Index of condition. |
Definition at line 228 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::initialize_random | ( | void | ) |
Definition at line 449 of file conditions_layer.cpp.
ConditionsLayer & OpenNN::ConditionsLayer::operator= | ( | const ConditionsLayer & | other_conditions_layer | ) |
Assignment operator. It assigns to this object the members of an existing conditions layer object.
other_conditions_layer | Conditions layer object to be assigned. |
Definition at line 87 of file conditions_layer.cpp.
bool OpenNN::ConditionsLayer::operator== | ( | const ConditionsLayer & | other_conditions_layer | ) | const |
Equal to operator. It compares this object with another object of the same class. It returns true if the members of the two objects have the same values, and false otherwise. @ param other_conditions_layer Conditions layer to be compared with.
Definition at line 112 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set | ( | void | ) |
Sets a conditions layer object with zero inputs and zero outputs. It also sets the rest of members to their default values.
Definition at line 250 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set | ( | const size_t & | new_external_inputs_number, |
const size_t & | new_conditions_neurons_number | ||
) |
Sets the numbers of external inputs and conditions neurons. It also sets the rest of members to their default values.
Definition at line 265 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set | ( | const ConditionsLayer & | other_conditions_layer | ) |
Sets the members of this conditions layer object with those from other conditions layer object.
other_conditions_layer | Conditions layer object to be copied. |
Definition at line 280 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_conditions_method | ( | const ConditionsMethod & | new_conditions_method | ) |
Sets a new method for calculating the conditions.
new_conditions_method | Conditions method. |
Definition at line 347 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_conditions_method | ( | const std::string & | new_conditions_method | ) |
Sets a new conditions method from the string.
new_conditions_method | String with the name of the conditions method. |
Definition at line 358 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_conditions_neurons_number | ( | const size_t & | new_conditions_neurons_number | ) |
Sets the number of conditions neurons in the layer.
new_conditions_neurons_number | Number of conditions neurons. |
Definition at line 336 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_display | ( | const bool & | new_display | ) |
Sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.
new_display | Display value. |
Definition at line 439 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_external_input_value | ( | const size_t & | i, |
const double & | new_external_input_value | ||
) |
Sets a single external input value.
i | Index of external input value. |
new_external_input_value | External input value. |
Definition at line 402 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_external_input_values | ( | const Vector< double > & | new_external_input_values | ) |
Sets a new vector of external input values.
new_external_input_values | External input values. |
Definition at line 390 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_external_inputs_number | ( | const size_t & | new_external_inputs_number | ) |
Sets the number of external inputs in the conditions layer.
new_external_inputs_number | Number of external inputs. |
Definition at line 325 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_output_value | ( | const size_t & | i, |
const size_t & | j, | ||
const double & | new_output_value | ||
) |
Sets a single output value.
i | Index of row. |
j | Index of column. |
new_output_value | Output value. |
Definition at line 426 of file conditions_layer.cpp.
void OpenNN::ConditionsLayer::set_output_values | ( | const Matrix< double > & | new_output_values | ) |
Sets a new matrix of output values.
new_output_values | Output values. |
Definition at line 413 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_conditions_method | ( | void | ) | const |
Returns a string with the name of the method for calculating the conditions. Avaliable methods include one conditions, two conditions or user defined conditions.
Definition at line 168 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_expression | ( | const Vector< std::string > & | external_inputs_names, |
const Vector< std::string > & | inputs_names, | ||
const Vector< std::string > & | outputs_names | ||
) | const |
Returns a string with the expression of the boundary conditions function.
external_inputs_names | Names of external inputs. |
inputs_names | Names of inputs. |
outputs_names | Names of outputs. |
Definition at line 1120 of file conditions_layer.cpp.
|
virtual |
Returns the expression of the homogeneous solution function.
external_inputs_names | Names of external inputs. |
homogeneous_solutions_names | Names of homogeneous solutions. |
Definition at line 1209 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_one_condition_homogeneous_solution_expression | ( | const Vector< std::string > & | external_inputs_names, |
const Vector< std::string > & | homogeneous_solutions_names | ||
) | const |
external_inputs_names | Names of external inputs. |
homogeneous_solutions_names | Names of homogeneous solutions. |
Definition at line 1265 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_one_condition_particular_solution_expression | ( | const Vector< std::string > & | external_inputs_names, |
const Vector< std::string > & | particular_solutions_names | ||
) | const |
external_inputs_names | Names of external inputs. |
particular_solutions_names | Names of particular solutions. |
Definition at line 1246 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_output_expression | ( | const Vector< std::string > & | particular_solutions_names, |
const Vector< std::string > & | homogeneous_solutions_names, | ||
const Vector< std::string > & | inputs_names, | ||
const Vector< std::string > & | outputs_names | ||
) | const |
Returns the mathematical expression of the function represented by the conditions layer.
particular_solutions_names | Names of particular solutions. |
homogeneous_solutions_names | Names of homogeneous solutions. |
inputs_names | Names of inputs. |
outputs_names | Names of outputs. |
Definition at line 1324 of file conditions_layer.cpp.
|
virtual |
Returns the expression of the particular solution function.
external_inputs_names | Names of external inputs. |
particular_solutions_names | Names of particular solutions. |
Definition at line 1171 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_two_conditions_homogeneous_solution_expression | ( | const Vector< std::string > & | external_inputs_names, |
const Vector< std::string > & | homogeneous_solutions_names | ||
) | const |
external_inputs_names | Names of external inputs. |
homogeneous_solutions_names | Names of homogeneous solutions. |
Definition at line 1303 of file conditions_layer.cpp.
std::string OpenNN::ConditionsLayer::write_two_conditions_particular_solution_expression | ( | const Vector< std::string > & | external_inputs_names, |
const Vector< std::string > & | particular_solutions_names | ||
) | const |
external_inputs_names | Names of external inputs. |
particular_solutions_names | Names of particular solutions. |
Definition at line 1284 of file conditions_layer.cpp.
|
protected |
Number of conditions neurons. This will be the number of outputs from the neural network.
Definition at line 203 of file conditions_layer.h.
|
protected |
Number of inputs to the conditions layer. This will be the number of inputs to the neural network.
Definition at line 198 of file conditions_layer.h.