Belle II Software  release-06-02-00
HopfieldNetwork.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 //basf2
11 #include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
12 
13 //ROOT
14 #include <TRandom.h>
15 
16 
17 namespace Belle2 {
37  public:
45  HopfieldNetwork(float omega = 0.5, float T = 3.1, float Tmin = 0.1, float cmax = 0.01):
46  m_omega(omega), m_T(T), m_Tmin(Tmin), m_cmax(cmax)
47  {}
48 
60  unsigned short doHopfield(std::vector<OverlapResolverNodeInfo>& overlapResolverNodeInfos, unsigned short nIterations = 20);
61 
62  private:
63  float m_omega;
64  float m_T;
65  float m_Tmin;
66  float m_cmax;
68  //--- Structs to help simplify the process ------------------------------------------------------------------------
70  struct TRandomWrapper {
72  typedef unsigned int result_type;
73 
75  static constexpr result_type min() { return 0; }
76 
78  static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
79 
81  result_type operator()() { return gRandom->Integer(max()); }
82  };
83  };
85 }
Hopfield Algorithm with number based inputs.
float m_omega
tuning parameter of the hopfield network
float m_T
start temperature of annealing
float m_cmax
maximal change of weights between iterations
unsigned short doHopfield(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfos, unsigned short nIterations=20)
Performance of the actual algorithm.
HopfieldNetwork(float omega=0.5, float T=3.1, float Tmin=0.1, float cmax=0.01)
Constructor taking parameters for the algorithm.
float m_Tmin
minimal temperature allowed
Abstract base class for different kinds of events.
Wrap TRandom to be useable as a uniform random number generator with std algorithms like std::shuffle...
static constexpr result_type max()
Maximum value returned by the random number generator.
result_type operator()()
Return a random value in the range [min(), max()].
static constexpr result_type min()
Minimum value returned by the random number generator.
unsigned int result_type
Define the result type to be a normal unsigned int.