nnfw/src/nnfwlibinitializer.cpp

00001 /********************************************************************************
00002  *  Neural Network Framework.                                                   *
00003  *  Copyright (C) 2005-2011 Gianluca Massera <emmegian@yahoo.it>                *
00004  *                                                                              *
00005  *  This program is free software; you can redistribute it and/or modify        *
00006  *  it under the terms of the GNU General Public License as published by        *
00007  *  the Free Software Foundation; either version 2 of the License, or           *
00008  *  (at your option) any later version.                                         *
00009  *                                                                              *
00010  *  This program is distributed in the hope that it will be useful,             *
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
00013  *  GNU General Public License for more details.                                *
00014  *                                                                              *
00015  *  You should have received a copy of the GNU General Public License           *
00016  *  along with this program; if not, write to the Free Software                 *
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  *
00018  ********************************************************************************/
00019 
00020 #include "nnfwconfig.h"
00021 #include "simplecluster.h"
00022 #include "biasedcluster.h"
00023 #include "ddecluster.h"
00024 #include "fakecluster.h"
00025 #include "copylinker.h"
00026 #include "dotlinker.h"
00027 #include "normlinker.h"
00028 #include "liboutputfunctions.h"
00029 #include "libperiodicfunctions.h"
00030 #include "libradialfunctions.h"
00031 #include "libcompetitivefunctions.h"
00032 #include "learningalgorithm.h"
00033 #include "backpropagationalgo.h"
00034 #include "factory.h"
00035 #include "logger.h"
00036 
00037 #include <QStringList>
00038 #include <QDebug>
00039 
00040 namespace farsa {
00041 
00042 bool FARSA_NNFW_API initNNFWLib() {
00043     static bool dummy = false;
00044     if ( dummy ) return true;
00045     // Registering all types to factory
00046     Factory::getInstance().registerClass<NeuralNet>("NeuralNet", "ParameterSettableWithConfigureFunction");
00047     Factory::getInstance().registerClass<Pattern>("Pattern", "ParameterSettableWithConfigureFunction");
00048     Factory::getInstance().registerClass<LearningAlgorithm>("LearningAlgorithm", "ParameterSettableWithConfigureFunction");
00049     Factory::getInstance().registerClass<BackPropagationAlgo>("BackPropagationAlgo", "LearningAlgorithm");
00050     // Clusters
00051     Factory::getInstance().registerClass<Updatable>("Updatable", "ParameterSettableInConstructor");
00052     Factory::getInstance().registerClass<Cluster>("Cluster", "Updatable");
00053     Factory::getInstance().registerClass<SimpleCluster>("SimpleCluster", "Cluster");
00054     Factory::getInstance().registerClass<BiasedCluster>("BiasedCluster", "Cluster");
00055     Factory::getInstance().registerClass<DDECluster>("DDECluster", "Cluster");
00056     Factory::getInstance().registerClass<FakeCluster>("FakeCluster", "Cluster");
00057 
00058     // Linkers
00059     Factory::getInstance().registerClass<Linker>("Linker", "Updatable");
00060     Factory::getInstance().registerClass<CopyLinker>("CopyLinker", "Linker");
00061     Factory::getInstance().registerClass<MatrixLinker>("MatrixLinker", "Linker");
00062     Factory::getInstance().registerClass<DotLinker>("DotLinker", "MatrixLinker");
00063     Factory::getInstance().registerClass<NormLinker>("NormLinker", "MatrixLinker");
00064 
00065     // Output Functions
00066     Factory::getInstance().registerClass<OutputFunction>("OutputFunction", "ParameterSettableWithConfigureFunction");
00067     
00068     Factory::getInstance().registerClass<FakeSigmoidFunction>("FakeSigmoidFunction", "OutputFunction");
00069     Factory::getInstance().registerClass<IdentityFunction>("IdentityFunction", "OutputFunction");
00070     Factory::getInstance().registerClass<GainFunction>("GainFunction", "OutputFunction");
00071     Factory::getInstance().registerClass<LinearFunction>("LinearFunction", "OutputFunction");
00072     Factory::getInstance().registerClass<RampFunction>("RampFunction", "OutputFunction");
00073     Factory::getInstance().registerClass<ScaleFunction>("ScaleFunction", "OutputFunction");
00074     Factory::getInstance().registerClass<ScaledSigmoidFunction>("ScaledSigmoidFunction", "OutputFunction");
00075     Factory::getInstance().registerClass<SigmoidFunction>("SigmoidFunction", "OutputFunction");
00076     Factory::getInstance().registerClass<StepFunction>("StepFunction", "OutputFunction");
00077     Factory::getInstance().registerClass<LeakyIntegratorFunction>("LeakyIntegratorFunction", "OutputFunction");
00078     Factory::getInstance().registerClass<LogLikeFunction>("LogLikeFunction", "OutputFunction");
00079     Factory::getInstance().registerClass<CompositeFunction>("CompositeFunction", "OutputFunction");
00080     Factory::getInstance().registerClass<LinearComboFunction>("LinearComboFunction", "OutputFunction");
00081     Factory::getInstance().registerClass<GaussFunction>("GaussFunction", "OutputFunction");
00082     Factory::getInstance().registerClass<PeriodicFunction>("PeriodicFunction", "OutputFunction");
00083     Factory::getInstance().registerClass<PseudoGaussFunction>("PseudoGaussFunction", "PeriodicFunction");
00084     Factory::getInstance().registerClass<SawtoothFunction>("SawtoothFunction", "PeriodicFunction");
00085     Factory::getInstance().registerClass<SinFunction>("SinFunction", "PeriodicFunction");
00086     Factory::getInstance().registerClass<TriangleFunction>("TriangleFunction", "PeriodicFunction");
00087     Factory::getInstance().registerClass<WinnerTakeAllFunction>("WinnerTakeAllFunction", "OutputFunction");
00088     dummy = true;
00089     Logger::info( "Library NNFW Initialized" );
00090     return true;
00091 }
00092 
00093 }