simplecluster.cpp
1 /********************************************************************************
2  * Neural Network Framework. *
3  * Copyright (C) 2005-2009 Gianluca Massera <emmegian@yahoo.it> *
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 2 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, write to the Free Software *
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
18  ********************************************************************************/
19 
20 #include "simplecluster.h"
21 #include "outputfunction.h"
22 
23 namespace farsa {
24 
25 SimpleCluster::SimpleCluster( unsigned int numNeurons, QString name )
26  : Cluster( numNeurons, name) {
27 }
28 
30  : Cluster( params, prefix ) {
31  // there is no extra parameters to configure
32 }
33 
35 }
36 
38  outFunction()->apply( inputs(), outputs() );
39  setNeedReset( true );
40 }
41 
42 void SimpleCluster::save(ConfigurationParameters& params, QString prefix) {
43  Cluster::save( params, prefix );
44  params.startObjectParameters( prefix, "SimpleCluster", this );
45  // there is no extra parameters to save
46 }
47 
48 void SimpleCluster::describe( QString type ) {
49  Cluster::describe( type );
50  addTypeDescription( type, "A simple Cluster" );
51 }
52 
53 }
virtual void apply(DoubleVector &inputs, DoubleVector &outputs)=0
Calculate the outputs of neurons by the net inputs given.
virtual ~SimpleCluster()
Destructor.
void update()
Update the outputs of neurons.
DoubleVector & inputs()
Get the array of inputs.
Definition: cluster.h:122
Define the common interface among Clusters.
Definition: cluster.h:73
This file contains the declaration of the abstract OutputFunction Class.
virtual void save(ConfigurationParameters &params, QString prefix)
Save the actual status of parameters into the ConfigurationParameters object passed.
Definition: cluster.cpp:129
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
bool startObjectParameters(QString groupPath, QString typeName, ParameterSettable *object)
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition: cluster.cpp:151
static Descriptor addTypeDescription(QString type, QString shortHelp, QString longHelp=QString(""))
OutputFunction * outFunction() const
Get the Output function.
Definition: cluster.h:149
DoubleVector & outputs()
Get the array of outputs.
Definition: cluster.h:136
virtual void save(ConfigurationParameters &params, QString prefix)
Save the actual status of parameters into the ConfigurationParameters object passed.
SimpleCluster(unsigned int numNeurons, QString name="unnamed")
Construct a Cluster that contains numNeurons neuron.
void setNeedReset(bool b)
Set the state of 'needReset' Used by subclasses into update implementation.
Definition: cluster.h:210