亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? network.h

?? amygdata的神經網絡算法源代碼
?? H
字號:
/***************************************************************************                          network.h  -  description                             -------------------    begin                : Thu Dec 13 2001    copyright            : (C) 2001-2005 by Matt Grover, Rudiger Koch    email                : mgrover@amygdala.org ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef NETWORK_H#define NETWORK_H#include <pthread.h>#include <map>#include <vector>#include <queue>#include <string>#include <stdio.h>#include <amygdala/dendrite.h>#include <amygdala/topology.h>#include <amygdala/axon.h>#include <amygdala/amygdalaclass.h>namespace Amygdala {using std::map;using std::string;using std::queue;using std::exception;class Neuron;class SpikingNeuron;class InputNeuron;class SpikeInput;class AxonNode;class Synapse;class FunctionLookup;class Trainer;class VisualStub;struct NeuronTopologyPtr {    Neuron* neuron;    Topology* topology;};/** @class Network network.h amygdala/network.h  * @brief Manages the simulation engine.  *  * This is a singleton class that controls the simulation.   * Network acts as the master container for the SNN and has   * methods for starting and stopping the simulation.  * A Network object is created at startup of the program and  * other Network objects cannot be created. To get a pointer to the Network object use  * Network::GetNetworkRef().  * @author Matt Grover <mgrover@amygdala.org>  * @author Rudiger Koch <rkoch@rkoch.org>  */class Network: public AmygdalaClass {private:  /** Users never create a Network object themselves.  See class description. */    Network();    Network(Network &);    Network(int & argc, char * argv[]);  /** this function is to speed up things for very small NNs */  void SimpleRun();  /** a thread goes to sleep here. The last thread cannot go to sleep. In case we are the last,    * false is returned.    */  bool ThreadSleep(unsigned int simTime);  /** wake up all sleeping network threads */  void ThreadWakeUp();  /** turn on listening on port for incoming spikes    * @param port the UDP port to listen at */  void UdpListener(int port);  static void ShiftArgs(int pos, int & argc, char* argv[]);    /** Schedule a call to SpikingNeuron::ProcessInput() for a neuron     * during the current time step. Used to identify Neurons that have input     * queued that has to be processed. This should only be called from     * Dendrite::SetNrnTrigger().     * @param nrn The Neuron requesting processing. */    void ScheduleNeuronProcess(SpikingNeuron* nrn) { processQ.push_back(nrn); }    /** Increment the offset index used for delayedSpikeQ. This is used as     * part of the delayed spike scheduler. */    inline void IncrementDelayOffset();    /** Send spikes to neurons through the synapses stored in     * delayedSpikeQueue for the current time step. */    void SendDelayedSpikes();    /** Initialize the delayed spike queue. */    void InitializeDelayedSpikeQ();    /** Set the maximum spike delay value that the delayed spike queue     * will handle.      * @param _delay The delay value. */    void SetMaxSpikeDelay(AmTimeInt _delay);    /** Add a neuron to the network. This is called automatically when     * neurons are added to a topology. It should not be called outside of     * that process. */    void AddNeuron(Neuron* nrn, Topology* top);    /** Add a topology object to the network. This is called automatically     * whenever a topology object is created.  It should not be called outside     * of that process. */    void AddTopology(Topology* top);    public:    ~Network();        /** Add a SpikeInput object to the network. This is called automatically     * when SpikeInput objects are created. */    void AddSpikeInput(SpikeInput* si);  	/** Run the simulation for a period of time    * @param maxRunTime the maximum time the simulation will run. */  	void Run(AmTimeInt maxRunTime);    /** Stop the network before maxRunTime is reached */    void Stop();  	/** @return A reference to the Network object */  	static Network* GetNetworkRef();  	unsigned int GetMaxRunTime();  	/** Save to a file. The file will get a .amg appended if it doesn't end on .amg.    * It will be a gzipped file for each NetworkPartition. All gzipped files will be tarred.    * @throw runtime_error If we cannot open the file, the temporary files or run    *        out of disk space or an Network is running    * @see NetLoader::SaveXML() */  	void Save(std::string filename, bool compress=true);  	/** Load an Amygdala network    * @see NetLoader::LoadXML()  */  	void Load(std::string filename, bool loadPhysProps=true);    /** Set the size of the simulation time steps. This     * must be set before Neurons are added.     * @param stepSize Time step size in microseconds. The default     * is 100 microseconds. */    static void SetTimeStepSize(AmTimeInt stepSize) { simStepSize = stepSize; }    /** @return The size of the time step in microseconds. */    static AmTimeInt TimeStepSize() { return simStepSize; }  	/** The thread scheduler for the network. For internal use only. Use Network::Run() instead.     * @see Network::Run() */  	void Schedule();    /** @return The current simulation time in microseconds */  	static AmTimeInt SimTime() { return simTime; }  	  	/** Set the number of threads to run. This function must not be called on a running simulation    * It impacts performance badly if set to a larger number than that of CPUs on the system    * @param threads the number of threads to run */  	void SetNumThreads(unsigned int threads);  	/** Initialize the network and create the Network object.  	 * This must be done before anything else is done with the network.  	 * @param argc argc from main()  	 * @param argv argv from main() */	static void Init(int & argc, char * argv[]);		/** Clean up the network after processing has completed. This will	 * stop all threads and free the memory. */  	static void Cleanup();  	/** @return a pointer to the GLDebugger object */  	VisualStub * GetVisualStub();    /** @return The largest neuron ID currently in the network. */    static AmIdInt MaxNeuronId() { return (nextNeuronId - 1); }    /** @return An unused neuron ID. */    static AmIdInt GetNewNeuronId() { return nextNeuronId++; }    /** @return Ptr to the network's FunctionLookup. */    FunctionLookup* GetFunctionLookup() const { return funcLookup; }    /************************************************************************     * Functions from NetworkPartition merge     ************************************************************************/    /** Schedule a neuron to send a spike.     * @param spikeTime Time that the neuron should spike.     * @param nrn The neuron scheduled to spike. */    void ScheduleSpike(AmTimeInt spikeTime, SpikingNeuron* nrn);    /** Schedule a neuron to send a spike.     * @param spikeTime Time that the neuron should spike.     * @param nrn The neuron scheduled to spike. */    void ScheduleSpike(AmTimeInt spikeTime, InputNeuron* nrn);    /** Schedule the transmission of a spike down an axon. This     *  may be done in order to implement spike batching or to     *  model transmission delays. This is normally called from     *  Neuron.     *  @param axon The axon vector from a Neuron. A spike will     *  be scheduled to cross each Synapse after the delay time has     *  passed.  Delay times are stored in Synapse and set when     *  Neurons are connected together.     *  @see Neuron::SendSpike() */    void ScheduleSpikeDelay(Axon* axon);    /** @return Pointer to the SpikeInput object that is being used. */    SpikeInput* GetSpikeInput(unsigned int idx) { return spikeInputVec[idx]; }    typedef std::vector<SpikeInput*>::const_iterator spikeinput_iterator;    spikeinput_iterator SpikeInput_begin() { return spikeInputVec.begin(); }    spikeinput_iterator SpikeInput_end() { return spikeInputVec.end(); }    /** Execute exactly one timeStep */    void TimeStep();        /** Get the Network ready to run.  This must be called after the neurons     * have been added to the network and before Run() or TimeStep(). */    void InitRun();    //TODO: These should probably be moved inside the cpp file so that    // a check for the neuronId can be done before trying to find in    // in the map (which will insert an element if the key is not found).        /** @return Ptr to a Neuron with id neuronId */    Neuron* GetNeuron(AmIdInt neuronId) { return nrnMap[neuronId].neuron; }        /** @return Ptr to the Topology object that contains neuron neuronId */    Topology* GetTopology(AmIdInt neuronId) { return nrnMap[neuronId].topology; }        /** @return Ptr to the Topology object that contains neuron nrn */    Topology* GetTopology(Neuron* nrn);        /** @return Ptr to the Topology object with name topologyName */    Topology* GetTopology(std::string& topologyName) { return topologyMap[topologyName]; }        /** @return NeuronTopologyPtr that contains neuron neuronId */    NeuronTopologyPtr& GetNeuronTopology(AmIdInt neuronId) { return nrnMap[neuronId]; }        /** @return Ptr to Trainer with name trainerName */    Trainer* GetTrainer(const std::string& trainerName) { return trainerMap[trainerName]; }        void AddTrainer(const std::string& trainerName, Trainer* t);    void SetTrainerCallback(Trainer* t, AmTimeInt callbackTime);    typedef std::map<std::string, Topology*>::const_iterator const_iterator;    const_iterator begin() const { return topologyMap.begin(); }    const_iterator end() const { return topologyMap.end(); }    typedef std::map<std::string, Trainer*>::const_iterator const_iterator_trainer;    const_iterator_trainer trainer_begin() const { return trainerMap.begin(); }    const_iterator_trainer trainer_end() const { return trainerMap.end(); }protected: // Protected attributes    /** The one and only network object  */    static Network * theNetwork;        /** the maximum time the networks of this network run */    AmTimeInt maxRunTime;    FunctionLookup* funcLookup;    /** SpikeRequest is used to keep track of scheduled spikes in the     * event queue. The priority_queue from the STL ranks entries     * based on the < operator (defined below). The ranking will be     * in order of spikeTime, requestTime, and requestOrder. */    struct SpikeRequest {        AmTimeInt spikeTime;     // Desired time of spike        AmTimeInt requestTime;   // Time SpikeRequest was entered in queue        unsigned int requestOrder;  // Entry number within a given time step.        SpikingNeuron* requestor;          // Neuron scheduling spike        // operator< overloaded to make the priority_queue happy        bool operator<(const SpikeRequest& sr) const        {            if(spikeTime != sr.spikeTime) {                return spikeTime>sr.spikeTime;            }            else if(requestTime != sr.requestTime) {                return requestTime>sr.requestTime;            }            else {                return requestOrder<sr.requestOrder;            }        }    };    struct InputSpikeRequest {        AmTimeInt spikeTime;     // Desired time of spike        AmTimeInt requestTime;   // Time SpikeRequest was entered in queue        unsigned int requestOrder;  // Entry number within a given time step.        InputNeuron* requestor;          // Neuron scheduling spike        // operator< overloaded to make the priority_queue happy        bool operator<(const InputSpikeRequest& sr) const        {            if(spikeTime != sr.spikeTime) {                return spikeTime>sr.spikeTime;            }            else if(requestTime != sr.requestTime) {                return requestTime>sr.requestTime;            }            else {                return requestOrder<sr.requestOrder;            }        }    };    struct TrainerCallback {        Trainer* trainer;        AmTimeInt callbackTime;        bool operator<(const TrainerCallback& rhs) const        {            // return > instead of < to force the smallest times to the top of the queue            return callbackTime>rhs.callbackTime;        }    };    std::priority_queue<SpikeRequest> eventQ;    // Main event queue    std::priority_queue<InputSpikeRequest> inputQ;    // Queue of inputs into network    std::priority_queue<TrainerCallback> trainerCallbackQ;    std::vector< std::vector<AxonNode*> > delayedSpikeQ;    std::vector< SpikingNeuron* > processQ;             // Queue of neurons that have input processing                                            // to do during the current time step                                                std::map<AmIdInt, NeuronTopologyPtr> nrnMap;    std::map<std::string, Topology*> topologyMap;    std::vector<SpikeInput*> spikeInputVec;    std::map<std::string, Trainer*> trainerMap;    AmTimeInt currSpikeDelayOffset;    AmTimeInt maxOffset;    AmTimeInt maxSpikeDelay;    Synapse* maxSpikeDelaySyn;  // TODO: What is this?    unsigned int spikeBatchCount;     AmTimeInt nextInputTime;    unsigned int eventRequestCount;         // Counter for SpikeRequest.requestOrder  /** reference time for the Network. NetworkPartition::simTime may not exceed this for more    * than one timeStep */  static AmTimeInt simTime;/** number of threads that went to sleep after emptying their spike input buffers.  * This doesn't mean that such a thread is simply waiting for the next timestep. If  * more requests become available through the still active threads a sleeping thread  * must be woken up. */  int sleepers;/** number of threads. This should be set to a value no greater than the number of CPUs on the  * system. Default is 1 */  unsigned int numThreads;  pthread_mutex_t mut_sleeper;  pthread_mutex_t mut_simtime;  pthread_cond_t cond_sleeper;/** contains all the thread handles */    std::vector<pthread_t*> threadHandles;    bool running;/** pointer to a visualizer object */    VisualStub * visualStub;    static AmTimeInt simStepSize;    static AmIdInt nextNeuronId;    friend void Dendrite::SetNrnTrigger();    friend void Axon::BuildNodes();    friend class Topology;    friend class TFactory;    friend class NetLoader;};inline void Network::IncrementDelayOffset(){    if (currSpikeDelayOffset >= maxOffset) {        currSpikeDelayOffset = 0;    }    else {        ++currSpikeDelayOffset;    }}} // namespace Amygdala#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区三区| 狂野欧美性猛交blacked| 亚洲福利一二三区| 精品在线一区二区| 99国产精品一区| 精品国产乱码久久久久久老虎 | 久久99蜜桃精品| 一本到高清视频免费精品| 日韩视频国产视频| 亚洲一区成人在线| 99精品一区二区三区| 精品av久久707| 美女在线视频一区| 欧美日韩免费观看一区二区三区 | 东方欧美亚洲色图在线| 7777精品久久久大香线蕉| 亚洲精品视频免费观看| 成人美女在线观看| 国产视频亚洲色图| 国产一区二区剧情av在线| 欧美mv日韩mv国产网站| 日韩av一区二区在线影视| 欧美日韩三级一区二区| 亚洲综合激情小说| 91九色最新地址| 樱花草国产18久久久久| 色婷婷亚洲婷婷| 夜夜嗨av一区二区三区网页| 91免费观看视频| 亚洲免费大片在线观看| 97se狠狠狠综合亚洲狠狠| 最近中文字幕一区二区三区| av午夜一区麻豆| 亚洲视频一二三区| 色婷婷av一区二区三区软件| 亚洲乱码国产乱码精品精可以看 | 在线电影欧美成精品| 夜夜精品视频一区二区| 欧美性生活久久| 亚洲综合色婷婷| 欧美一区二区三区思思人| 日本成人在线不卡视频| www日韩大片| 国产成人av福利| 亚洲免费观看在线视频| 欧美艳星brazzers| 免费观看30秒视频久久| 国产欧美一区二区精品仙草咪| 成人av网站在线| 亚洲精品水蜜桃| 91精品欧美综合在线观看最新| 精品在线免费观看| 中文字幕欧美一| 欧美午夜视频网站| 久久99精品久久久久久久久久久久| 久久九九全国免费| 色诱亚洲精品久久久久久| 亚洲成在线观看| 26uuu国产日韩综合| 99免费精品视频| 三级不卡在线观看| 国产欧美日韩在线| 欧美中文字幕一区| 激情偷乱视频一区二区三区| 亚洲麻豆国产自偷在线| 日韩欧美自拍偷拍| 成人黄色av电影| 日韩av午夜在线观看| 国产精品理论在线观看| 欧美电影一区二区| 波多野结衣精品在线| 日韩国产欧美在线视频| 亚洲天堂av老司机| 欧美不卡一区二区| 欧美三级一区二区| 成人综合在线视频| 男人的天堂久久精品| 亚洲人精品午夜| 久久久精品免费免费| 欧美日韩视频在线一区二区| 成人免费看黄yyy456| 免费日韩伦理电影| 一区二区三区日韩精品| 国产视频一区在线播放| 91麻豆精品久久久久蜜臀| 99久久99久久综合| 极品美女销魂一区二区三区| 一区二区三区四区不卡在线| 中文字幕不卡三区| 日韩一区二区电影网| 色综合天天天天做夜夜夜夜做| 国产资源精品在线观看| 日韩激情在线观看| 一区二区三区国产精华| 中文字幕av不卡| 久久蜜桃一区二区| 欧美一区二区三区小说| 欧美日本免费一区二区三区| 91在线观看高清| 成人av综合一区| 国产乱人伦偷精品视频免下载| 日韩国产精品久久久| 亚洲一区av在线| 亚洲午夜电影网| 一区二区三区欧美激情| 亚洲人精品一区| 国产精品成人免费| 国产精品久久久久影院老司| 国产精品午夜在线| 国产精品色哟哟| 国产精品美女久久久久久2018| 日韩欧美电影一区| 精品日韩在线观看| 精品久久久久一区| 久久先锋资源网| 久久嫩草精品久久久精品一| 久久免费电影网| 国产片一区二区三区| 中文字幕免费不卡在线| 中文欧美字幕免费| 亚洲三级电影网站| 亚洲午夜影视影院在线观看| 日韩综合在线视频| 日本欧美在线看| 精品一区二区三区av| 国产精品亚洲一区二区三区在线| 国产精品系列在线观看| www.亚洲色图.com| 91视频国产观看| 欧美色大人视频| 日韩久久免费av| 国产精品久久久久毛片软件| 亚洲欧洲中文日韩久久av乱码| 亚洲精品欧美综合四区| 午夜不卡在线视频| 国产在线精品免费| 97久久精品人人爽人人爽蜜臀| 欧美亚洲国产怡红院影院| 欧美一级高清大全免费观看| 日韩精品一区二区三区中文精品| 精品国产3级a| 亚洲黄色av一区| 蜜桃91丨九色丨蝌蚪91桃色| 国产成a人亚洲精品| 欧美日韩一区二区三区高清 | 亚洲成精国产精品女| 精久久久久久久久久久| av亚洲精华国产精华| 91精选在线观看| 国产精品少妇自拍| 日本不卡免费在线视频| 高清不卡在线观看| 欧美一区二区三区精品| 久久免费的精品国产v∧| 亚洲一区二区三区视频在线播放| 久久精品国产网站| 色狠狠桃花综合| 久久综合999| 午夜av电影一区| 成a人片亚洲日本久久| 91精品国产美女浴室洗澡无遮挡| 中文字幕免费观看一区| 免费在线看一区| 欧美午夜精品久久久久久孕妇| 日本一区二区三区四区在线视频| 亚洲a一区二区| 不卡在线观看av| 精品久久久久久无| 亚洲国产精品欧美一二99| 国产乱国产乱300精品| 欧美精品在线视频| 日韩一区在线看| 国产成人av一区二区| 日韩欧美综合一区| 午夜久久久久久久久久一区二区| av成人免费在线| 久久久久国产精品麻豆| 日本不卡高清视频| 欧美午夜精品久久久久久孕妇| 中文字幕亚洲综合久久菠萝蜜| 国产一区二区按摩在线观看| 欧美一区二区视频免费观看| 亚洲在线观看免费| 一本一道久久a久久精品| 国产午夜精品理论片a级大结局| 男女男精品视频| 欧美一区二区网站| 日韩精品福利网| 欧美老女人在线| 亚洲国产另类精品专区| 在线视频一区二区三| 亚洲欧美日本韩国| 91麻豆高清视频| 亚洲欧洲精品天堂一级| 成人亚洲一区二区一| 国产清纯白嫩初高生在线观看91 | 亚洲免费高清视频在线| 99综合电影在线视频| 国产精品美女一区二区三区| 国产成人精品影视|