Belle II Software  release-05-01-25
HopfieldNetwork.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2011 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Heck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 //basf2
13 #include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
14 
15 //ROOT
16 #include <TRandom.h>
17 
18 
19 namespace Belle2 {
38  class HopfieldNetwork {
39  public:
47  HopfieldNetwork(float omega = 0.5, float T = 3.1, float Tmin = 0.1, float cmax = 0.01):
48  m_omega(omega), m_T(T), m_Tmin(Tmin), m_cmax(cmax)
49  {}
50 
62  unsigned short doHopfield(std::vector<OverlapResolverNodeInfo>& overlapResolverNodeInfos, unsigned short nIterations = 20);
63 
64  private:
65  float m_omega;
66  float m_T;
67  float m_Tmin;
68  float m_cmax;
70  //--- Structs to help simplify the process ------------------------------------------------------------------------
72  struct TRandomWrapper {
74  typedef unsigned int result_type;
75 
77  static constexpr result_type min() { return 0; }
78 
80  static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
81 
83  result_type operator()() { return gRandom->Integer(max()); }
84  };
85  };
87 }
Belle2::HopfieldNetwork::TRandomWrapper::operator()
result_type operator()()
Return a random value in the range [min(), max()].
Definition: HopfieldNetwork.h:91
Belle2::HopfieldNetwork::m_cmax
float m_cmax
maximal change of weights between iterations
Definition: HopfieldNetwork.h:76
Belle2::HopfieldNetwork::TRandomWrapper::min
static constexpr result_type min()
Minimum value returned by the random number generator.
Definition: HopfieldNetwork.h:85
Belle2::HopfieldNetwork::TRandomWrapper::max
static constexpr result_type max()
Maximum value returned by the random number generator.
Definition: HopfieldNetwork.h:88
Belle2::HopfieldNetwork::TRandomWrapper::result_type
unsigned int result_type
Define the result type to be a normal unsigned int.
Definition: HopfieldNetwork.h:82
Belle2::HopfieldNetwork::m_T
float m_T
start temperature of annealing
Definition: HopfieldNetwork.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HopfieldNetwork::doHopfield
unsigned short doHopfield(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfos, unsigned short nIterations=20)
Performance of the actual algorithm.
Definition: HopfieldNetwork.cc:21
Belle2::HopfieldNetwork::m_omega
float m_omega
tuning parameter of the hopfield network
Definition: HopfieldNetwork.h:73
Belle2::HopfieldNetwork::HopfieldNetwork
HopfieldNetwork(float omega=0.5, float T=3.1, float Tmin=0.1, float cmax=0.01)
Constructor taking parameters for the algorithm.
Definition: HopfieldNetwork.h:55
Belle2::HopfieldNetwork::m_Tmin
float m_Tmin
minimal temperature allowed
Definition: HopfieldNetwork.h:75