Connection.h 2.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
/**
 * DESCRIPTION OF THE FILE
 *
 * @author Michal Kravčenko
 * @date 13.6.18 -
 */

#ifndef INC_4NEURO_CONNECTION_H
#define INC_4NEURO_CONNECTION_H

#include "../Neuron/Neuron.h"
12
13
#include "ConnectionWeight.h"

14
class Neuron;
15
class ConnectionWeight;
16
17

/**
18
 * Class representing directed connection between two neurons
19
20
21
 */
class Connection {
private:
22

23
    /**
24
     * Pointer to an object evaluating the weight function
25
     */
26
    ConnectionWeight *con = nullptr;
27
    /**
28
     * Pointer to the Neuron on the receiving end of this connection
29
     */
30
    Neuron *neuron_in = nullptr;
31
32

    /**
33
     * Pointer to the Neuron on the signaling end of this connection
34
     */
35
36
    Neuron *neuron_out = nullptr;

37

38
    //TODO pridat gradient pro ucely backpropagation
39
40
41

public:

42
43
44
45
46
47
   /**
    * Constructor
    * @param[in] n_in Pointer to the Neuron on the receiving end of this connection
    * @param[in] n_out Pointer to the Neuron on the signaling end of this connection
    * @param[in] con Pointer to an object evaluating the weight function
    */
48
    Connection(Neuron *n_in, Neuron *n_out, ConnectionWeight* con);
49
50

    /**
51
     * Destructor, deletes the 'con' object
52
     */
53
    ~Connection();
54
55

    /**
56
57
58
     * Takes the array of double values and alters the corresponding weights associated
     * with the 'con' object
     * @param[in] values Values to be added to the associated weights
59
     */
60
    void adjust_weights(double *values);
61
62

    /**
63
64
65
     * Takes the array of double values and sets the corresponding weights associated
     * with the 'con' object
     * @param[in] values Values to be set to the associated weights
66
     */
67
    void set_weights(double *values);
68
69

    /**
70
71
72
     * Takes the output signal of Neuron 'neuron_out', multiplies it by the result of the
     * weight function associated with this connection and adds the result to the potential
     * of the Neuron 'neuron_in'
73
74
75
76
77
     */
    void pass_signal();


    /**
78
     * Returns the pointer to the Neuron on the receiving end of this connection
79
80
81
82
83
     * @return
     */
    Neuron* get_neuron_in();

    /**
84
     * Returns the pointer to the Neuron on the signaling end of this connection
85
86
87
88
89
90
91
92
     * @return
     */
    Neuron* get_neuron_out();

};


#endif //INC_4NEURO_CONNECTION_H