Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
Public Member Functions | Private Attributes | List of all members
CNeuron Class Reference

Neuron in a Hopfield network. More...

#include <NeuralNet.h>

Inheritance diagram for CNeuron:
CEdge

Public Member Functions

 CNeuron (CVertex *p0, CVertex *p1, UINT index)
 Constructor. More...
 
int GetState ()
 Get neuron state. More...
 
bool IsStable ()
 Stability test. More...
 
void SetState (int n)
 Get neuron state. More...
 
bool GetOutput ()
 Get neuron output. More...
 
void SetOutput (bool b)
 Set neuron output. More...
 
- Public Member Functions inherited from CEdge
 CEdge (CVertex *p0, CVertex *p1, UINT index)
 Constructor. More...
 
CVertexGetNextVertex (CVertex *p)
 Get vertex at other end of edge. More...
 
UINT GetIndex ()
 Get index;. More...
 
void Mark (bool b=true)
 Mark or unmark. More...
 
bool Marked ()
 Get mark. More...
 
void GetVertexIndices (UINT &i0, UINT &i1)
 Get vertex indices. More...
 

Private Attributes

int m_nState = 0
 Neuron state.
 
int m_nOldState = 0
 Old neuron state.
 
int m_bOutput = false
 Neuron output.
 

Additional Inherited Members

- Protected Attributes inherited from CEdge
CVertexm_pVertex0 = nullptr
 Vertex at one end of the edge,.
 
CVertexm_pVertex1 = nullptr
 Vertex at the other end of the edge.
 
UINT m_nIndex = 0
 Index into edge list.
 
bool m_bMarked = false
 Mark flag.
 

Detailed Description

A neuron in a Hopfield network is a graph edge with the extra properties of state and output. The state from the previous update is also stored in order to check for convergence.

Definition at line 41 of file NeuralNet.h.

Constructor & Destructor Documentation

◆ CNeuron()

CNeuron::CNeuron ( CVertex p0,
CVertex p1,
UINT  index 
)

Creates neuron between two vertices.

Parameters
p0Pointer to vertex incident with neuron.
p1Pointer to vertex incident with neuron.
indexIndex of neuron.

Definition at line 36 of file NeuralNet.cpp.

Member Function Documentation

◆ GetOutput()

bool CNeuron::GetOutput ( )

Reader function for output.

Returns
Output.

Definition at line 66 of file NeuralNet.cpp.

◆ GetState()

int CNeuron::GetState ( )

Reader function for state.

Returns
State.

Definition at line 43 of file NeuralNet.cpp.

◆ IsStable()

bool CNeuron::IsStable ( )

A neuron is stable if its state hasn't changed since the last time it was updated.

Returns
true if stable.

Definition at line 51 of file NeuralNet.cpp.

◆ SetOutput()

void CNeuron::SetOutput ( bool  b)

Set output.

Parameters
bNew output.

Definition at line 73 of file NeuralNet.cpp.

◆ SetState()

void CNeuron::SetState ( int  n)

Set state.

Parameters
nNew state.

Definition at line 58 of file NeuralNet.cpp.