#ifndef _H_SIMMODULES #define _H_SIMMODULES #include "libcsim.hpp" #include "input.hpp" #include "simmodule.hpp" using namespace std; enum SimMod_StimSetType {Test, Parametric, Scan, FileName, IdlMovieFile, Ascii, MovieScan, Sequence}; static const int SimMod_NumberStimSetTypes=8; class SimMod_CompetitiveInhibition: SimModule { private: layer* ExLayer; layer* InhLayer; int NInhNeurons; int NExInhConnections; int NInhExConnections; int NInhInhConnections; float ExInhStrength; float InhExStrength; float InhInhStrength; float NmdaAmpaRatio; Connection* conInhEx; Connection* conInhInh; Connection* conExInh; public: SimMod_CompetitiveInhibition(AnyOptionWrapper* _opt); virtual void SetCmdLineOptions(); virtual layer* Setup(layer* _ExLayer, bool LoadWeights=false, bool VecCon=false, bool SaveInitialWeights=true); void SetAllInhExWeights(float WeightValue); void SetInhExWeightStrength(float WeightStrength); }; class SimModuleITLayer: SimModule { private: float ITTauInhibition; // float ITTauFeeding; float NmdaAmpaRatio; int ITNx, ITNy; float ITLateralInhibitionWeight; float ITSelfLearnRate; bool ITSelfInhFacilitation; float SelfInhCdep; float SelfInhMaxWeight; float SelfInhMinWeight; float LatInhDistance; layer* ITLayer; connection *ConITSelfInh; SimMod_CompetitiveInhibition CompInh; public: SimModuleITLayer(AnyOptionWrapper* _opt); ~SimModuleITLayer(); virtual void SetCmdLineOptions(); virtual layer* Setup( SimLoop *MainSimLoop, int NType, bool LoadWeights, bool Learn, bool InhResetable=false, // inhibition layer per default not resetable (to keep inhibition level in network after reset) bool SaveInitialWeights=true ); void SetInhExWeightStrength(float NewInhExStrength); bool LoadITWeights; SimMod_CompetitiveInhibition* GetCompInhibitionPtr(){return &CompInh;}; SpikeTrain* ItSpikeTrain(); }; // erhaelt nur Gauss-Blob-verschalteten Vorwaerts-Input von MapLayer class InvarLayer: SimModule { private: float FWConStrength; layer* MapLayer; csimNeuronType NType; layer* LInvar; Connection* conMapLInvar; int Nx, Ny; bool VecCon; public: InvarLayer(AnyOptionWrapper* _opt); ~InvarLayer(); virtual void SetCmdLineOptions(); virtual layer* Setup(layer* _MapLayer, bool _veccon=false, bool SaveInitialWeights=true); virtual void TurnOn(); virtual void TurnOff(); }; class SimModuleInput: SimModule { private: int StimulusSet; int StimulusNumber; string MovieDir; string StimFileName; string StimSequence; ObjMovie* MyMovie; SimMod_StimSetType SType; bool XContinuous; int NXParas, NYParas; int NTestStimuli; public: SimModuleInput(AnyOptionWrapper* _opt); // ~SimModuleInput(); virtual void SetCmdLineOptions(); virtual input* Setup(layer* TargetLayer, csimInputChannel InputNumber, float InputStrength); virtual void LoadMovie(int &InputNx, int &InputNy, int &NStimuli); int StimDur; int IsiDur; }; class SimModuleMovieInput: SimModule { private: int NFilters, NLayers; string MovieDir; string StimFileName; string StimSequence; ObjMovie* MyMovie; // SimMod_StimSetType SType; bool XContinuous; int NXParas, NYParas; int InputNx, InputNy; float InitialWeights; float FRateNormThreshold; bool CommonInhibition; bool RewireForwardCon; layer* InhLayer; float ExInhWeights, InhExWeights; int TestStepSize; // default==1, wenn ==2, dann wird nur jeder zweite Stimulus in X bzw. Y Richtung als Test verwendet void LoadMovie(); public: SimModuleMovieInput(AnyOptionWrapper* _opt); ~SimModuleMovieInput(); virtual void SetCmdLineOptions(); virtual int Setup(csimInputChannel InputNumber, float InputStrength, bool LoadWeights=false); virtual void SetTestMode(); virtual void SetInputMode(InputMode mode); virtual void ConnectTo(layer* tolayer, bool LoadForwardWeights, bool Learn); int NStimuli; int NTestStimuli; int StimDur; int IsiDur; float LearnRate; }; // smodMovieInput ist eine Weiterentwicklung von SimModuleMovieInput // sie soll die Nutzung von VecConnections ermoeglichen // smodMovieInput soll SimModuleMovieInput abloesen class smodMovieInput: SimModule { private: int NFilters, NLayers; string MovieDir; string StimFileName; string TestStimFileName; string SequenceFileName; ObjMovie* MyMovie; ObjMovie* StimMovie, TestMovie; // SimMod_StimSetType SType; bool XContinuous; int NXParas, NYParas; int InputNx, InputNy; float InitialWeights; float TauDecLearnPre; float TauDecLearnPost; float FRateNormThreshold; bool CommonInhibition; bool RewireForwardCon; bool OnOffInput; //< true: every input frame is feed into two layers: on layer (positive values) and off layer (negative values) layer* InhLayer; float ExInhWeights, InhExWeights; int TestStepSize; // default==1, wenn ==2, dann wird nur jeder zweite Stimulus in X bzw. Y Richtung als Test verwendet void LoadMovie(string _StimFileName); void ChangeMovie(ObjMovie* _NewMovie); public: smodMovieInput(AnyOptionWrapper* _opt); ~smodMovieInput(); virtual void SetCmdLineOptions(); virtual int Setup(csimInputChannel InputNumber, float InputStrength, bool LoadWeights=false); void SetNoiseAmplitude(float sigma); virtual void SetTestMode(); virtual void SetInputMode(InputMode mode); virtual void ConnectTo(layer* tolayer, bool LoadForwardWeights, bool Learn, bool VecCon=false, bool SaveInitialWeights=true); int NStimuli; int NTestStimuli; int StimDur; int IsiDur; float LearnRate; }; #endif /*_H_SIMMODULES */