00001 /************************************************************************ 00002 * Verve * 00003 * Copyright (C) 2004-2006 * 00004 * Tyler Streeter tylerstreeter@gmail.com * 00005 * All rights reserved. * 00006 * Web: http://verve-agents.sourceforge.net * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of EITHER: * 00010 * (1) The GNU Lesser General Public License as published by the Free * 00011 * Software Foundation; either version 2.1 of the License, or (at * 00012 * your option) any later version. The text of the GNU Lesser * 00013 * General Public License is included with this library in the * 00014 * file license-LGPL.txt. * 00015 * (2) The BSD-style license that is included with this library in * 00016 * the file license-BSD.txt. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * 00021 * license-LGPL.txt and license-BSD.txt for more details. * 00022 ************************************************************************/ 00023 00024 #ifndef VERVE_POPULATION_H 00025 #define VERVE_POPULATION_H 00026 00027 #include "Globals.h" 00028 #include "TDConnection.h" 00029 #include "Projection.h" 00030 00031 namespace verve 00032 { 00033 class Neuron; 00034 00036 class Population 00037 { 00038 public: 00039 VERVE_DECL Population(); 00040 00042 VERVE_DECL virtual ~Population(); 00043 00047 VERVE_DECL virtual void VERVE_CALL init(unsigned int numNeurons); 00048 00050 VERVE_DECL virtual void VERVE_CALL resetShortTermMemory(); 00051 00056 VERVE_DECL virtual void VERVE_CALL project(Population* pop, 00057 InitialWeightMethod initWeightMethod, 00058 real maxInputPopActivationSum); 00059 00065 VERVE_DECL virtual void VERVE_CALL projectTD(Population* pop, 00066 TDConnectionType type, 00067 InitialWeightMethod initWeightMethod, 00068 real maxInputPopActivationSum); 00069 00072 VERVE_DECL virtual void VERVE_CALL updateFiringRatesLinear(); 00073 00076 VERVE_DECL virtual void VERVE_CALL 00077 updateFiringRatesLinearBoundedNegOneToOne(); 00078 00081 VERVE_DECL virtual void VERVE_CALL 00082 updateFiringRatesLinearBoundedZeroToOne(); 00083 00086 VERVE_DECL virtual void VERVE_CALL updateFiringRatesSigmoid(); 00087 00094 VERVE_DECL virtual real VERVE_CALL trainPreDeltaRuleLinear( 00095 const real* actualOutputs, real learningFactor); 00096 00098 VERVE_DECL virtual unsigned int VERVE_CALL getNumNeurons()const; 00099 00101 VERVE_DECL virtual Neuron* VERVE_CALL getNeuron(unsigned int i); 00102 00105 VERVE_DECL virtual void VERVE_CALL normalizeInputWeights(); 00106 00109 VERVE_DECL virtual void VERVE_CALL setPostETraceDecayFactors( 00110 real value); 00111 00113 // are assumed to be TDProjections). 00114 VERVE_DECL virtual void VERVE_CALL setPostTDDiscountFactors( 00115 real value); 00116 00117 protected: 00119 virtual void clear(); 00120 00122 virtual void createNeuron(unsigned int id); 00123 00125 std::vector<Neuron*> mNeurons; 00126 00128 std::vector<Projection*> mOutputProjections; 00129 }; 00130 } 00131 00132 #endif