OpenNN  2.2
Open Neural Networks Library
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenNN::ConditionsLayer Class Reference

#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)
 
ConditionsLayeroperator= (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 ConditionsMethodget_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
 

Detailed Description

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.

Constructor & Destructor Documentation

OpenNN::ConditionsLayer::ConditionsLayer ( void  )
explicit

Default constructor. It creates a conditions layer object.

Definition at line 26 of file conditions_layer.cpp.

OpenNN::ConditionsLayer::ConditionsLayer ( const size_t &  new_inputs_number,
const size_t &  new_conditions_neurons_number 
)
explicit

Inputs and outputs number constructor.

Parameters
new_inputs_numberNumber of inputs.
new_conditions_neurons_numberNumber of conditions neurons.

Definition at line 40 of file conditions_layer.cpp.

OpenNN::ConditionsLayer::ConditionsLayer ( const tinyxml2::XMLDocument &  conditions_layer_document)
explicit

XML constructor.

Parameters
conditions_layer_documentPointer 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.

Parameters
other_conditions_layerConditions layer object to be copied.

Definition at line 66 of file conditions_layer.cpp.

Member Function Documentation

Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_Hessian_form ( const Vector< double > &  ,
const Vector< double > &   
) const
Todo:

Definition at line 785 of file conditions_layer.cpp.

Vector< double > OpenNN::ConditionsLayer::calculate_homogeneous_solution ( const Vector< double > &  external_inputs) const
virtual

Returns the homogeneous solution for applying boundary conditions.

Returns the homogeneous solution values for applying conditions.

Parameters
external_inputsVector of external inputs.

Definition at line 645 of file conditions_layer.cpp.

Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_homogeneous_solution_Hessian_form ( const Vector< double > &  external_inputs) const
virtual

Returns the Hessian form of the homogeneous solution function.

Parameters
external_inputsVector of external inputs.

Definition at line 717 of file conditions_layer.cpp.

Matrix< double > OpenNN::ConditionsLayer::calculate_homogeneous_solution_Jacobian ( const Vector< double > &  external_inputs) const
virtual

Returns the homogeneous solution Jacobian for applying boundary conditions.

Returns the homogeneous solution Jacobian for applying conditions.

Parameters
external_inputsVector 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.

Parameters
external_inputsVector of external inputs.
outputsVector of outputs from the conditions layer.
JacobianPartial 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.

Parameters
external_inputsVector 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.

Todo:

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.

Parameters
external_inputsVector 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.

Todo:

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.

Parameters
external_inputsVector of external inputs.
inputsVector of inputs to the conditons layer.

Definition at line 754 of file conditions_layer.cpp.

Vector< double > OpenNN::ConditionsLayer::calculate_particular_solution ( const Vector< double > &  external_inputs) const
virtual

Returns the particular solution for applying boundary conditions.

Returns the particular solution function for applying conditions.

Parameters
external_inputsVector of external inputs.

Definition at line 537 of file conditions_layer.cpp.

Vector< Matrix< double > > OpenNN::ConditionsLayer::calculate_particular_solution_Hessian_form ( const Vector< double > &  external_inputs) const
virtual

Returns the Hessian form of the particular solution.

Parameters
external_inputsVector of external inputs.

Definition at line 609 of file conditions_layer.cpp.

Matrix< double > OpenNN::ConditionsLayer::calculate_particular_solution_Jacobian ( const Vector< double > &  external_inputs) const
virtual

Returns the particular solution Jacobian for applying boundary conditions.

Returns the particular solution Jacobian for applying conditions.

Parameters
external_inputsVector 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.

Parameters
external_inputsVector 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.

Parameters
external_inputsVector 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.

Parameters
external_inputsVector 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.

Todo:

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.

Todo:

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.

Parameters
documentTinyXML document containing the member data.
Todo:

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.

Parameters
iIndex 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.

Parameters
iIndex of output.
jIndex of condition.

Definition at line 228 of file conditions_layer.cpp.

void OpenNN::ConditionsLayer::initialize_random ( void  )
Todo:

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.

Parameters
other_conditions_layerConditions 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.

Parameters
other_conditions_layerConditions 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.

Parameters
new_conditions_methodConditions 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.

Parameters
new_conditions_methodString 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.

Parameters
new_conditions_neurons_numberNumber 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.

Parameters
new_displayDisplay 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.

Parameters
iIndex of external input value.
new_external_input_valueExternal 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.

Parameters
new_external_input_valuesExternal 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.

Parameters
new_external_inputs_numberNumber 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.

Parameters
iIndex of row.
jIndex of column.
new_output_valueOutput 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.

Parameters
new_output_valuesOutput 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.

Parameters
external_inputs_namesNames of external inputs.
inputs_namesNames of inputs.
outputs_namesNames of outputs.
Todo:

Definition at line 1120 of file conditions_layer.cpp.

std::string OpenNN::ConditionsLayer::write_homogeneous_solution_expression ( const Vector< std::string > &  external_inputs_names,
const Vector< std::string > &  homogeneous_solutions_names 
) const
virtual

Returns the expression of the homogeneous solution function.

Parameters
external_inputs_namesNames of external inputs.
homogeneous_solutions_namesNames of homogeneous solutions.
Todo:

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
Parameters
external_inputs_namesNames of external inputs.
homogeneous_solutions_namesNames of homogeneous solutions.
Todo:

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
Parameters
external_inputs_namesNames of external inputs.
particular_solutions_namesNames of particular solutions.
Todo:

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.

Parameters
particular_solutions_namesNames of particular solutions.
homogeneous_solutions_namesNames of homogeneous solutions.
inputs_namesNames of inputs.
outputs_namesNames of outputs.

Definition at line 1324 of file conditions_layer.cpp.

std::string OpenNN::ConditionsLayer::write_particular_solution_expression ( const Vector< std::string > &  external_inputs_names,
const Vector< std::string > &  particular_solutions_names 
) const
virtual

Returns the expression of the particular solution function.

Parameters
external_inputs_namesNames of external inputs.
particular_solutions_namesNames of particular solutions.
Todo:

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
Parameters
external_inputs_namesNames of external inputs.
homogeneous_solutions_namesNames of homogeneous solutions.
Todo:

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
Parameters
external_inputs_namesNames of external inputs.
particular_solutions_namesNames of particular solutions.
Todo:

Definition at line 1284 of file conditions_layer.cpp.

Member Data Documentation

size_t OpenNN::ConditionsLayer::conditions_neurons_number
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.

size_t OpenNN::ConditionsLayer::external_inputs_number
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.


The documentation for this class was generated from the following files: