CARLsim  3.0.3
CARLsim: a GPU-accelerated SNN simulator
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
simple_weight_tuner.h
Go to the documentation of this file.
1 #ifndef _SIMPLE_WEIGHT_TUNER_H_
2 #define _SIMPLE_WEIGHT_TUNER_H_
3 
4 class CARLsim;
5 class SpikeMonitor;
6 struct RangeWeight;
7 
42 public:
59  SimpleWeightTuner(CARLsim *sim, double errorMargin=1e-3, int maxIter=100, double stepSizeFraction=0.5);
60 
68 
87  void setConnectionToTune(short int connId, double initWt=-1.0, bool adjustRange=true);
88 
106  void setTargetFiringRate(int grpId, double targetRate);
107 
126  void iterate(int runDurationMs=1000, bool printStatus=true);
127 
140  bool done(bool printMessage=false);
141 
149  void reset();
150 
151 
152 private:
154  void initAlgo();
155 
156  // flags that manage state
157  bool needToInitConnection_;
158  bool needToInitTargetFiring_;
159  bool needToInitAlgo_;
160 
161  // CARLsim data structures
162  CARLsim *sim_;
163  SpikeMonitor *SM_;
164  int grpId_;
165  short int connId_;
166  RangeWeight* wtRange_;
167 
168  // termination condition params
169  int maxIter_;
170  double errorMargin_;
171  double targetRate_;
172 
173  // params that are updated every iteration step
174  int cntIter_;
175  double wtStepSize_;
176  bool wtShouldIncrease_;
177  double currentError_;
178 
179  // options
180  bool adjustRange_;
181  double wtInit_;
182  double stepSizeFraction_;
183 };
184 
185 #endif
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
Definition: carlsim.h:142
void setConnectionToTune(short int connId, double initWt=-1.0, bool adjustRange=true)
Sets up the connection to tune.
~SimpleWeightTuner()
Destructor.
Class SpikeMonitor.
SimpleWeightTuner(CARLsim *sim, double errorMargin=1e-3, int maxIter=100, double stepSizeFraction=0.5)
Creates a new instance of class SimpleWeightTuner.
void reset()
Resets the algorithm to initial conditions.
bool done(bool printMessage=false)
Determines whether a termination criterion has been met.
void setTargetFiringRate(int grpId, double targetRate)
Sets up the target firing rate of a specific group.
void iterate(int runDurationMs=1000, bool printStatus=true)
Performs an iteration step of the tuning algorithm.
a range struct for synaptic weight magnitudes
Class SimpleWeightTuner.