Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
NeuralNet.h
Go to the documentation of this file.
1 
4 // MIT License
5 //
6 // Copyright (c) 2019 Ian Parberry
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 
26 #include "Includes.h"
27 #include "Random.h"
28 
29 #ifndef __NeuralNet__
30 #define __NeuralNet__
31 
32 #include "Graph.h"
33 
40 
41 class CNeuron: public CEdge{
42  private:
43  int m_nState = 0;
44  int m_nOldState = 0;
45  int m_bOutput = false;
46 
47  public:
48  CNeuron(CVertex* p0, CVertex* p1, UINT index);
49 
50  int GetState();
51  bool IsStable();
52  void SetState(int n);
53 
54  bool GetOutput();
55  void SetOutput(bool b);
56 }; //CNeuron
57 
59 
63 
64 class CNeuralNet: public CGraph{
65  public:
66  CNeuralNet(UINT n, int seed);
67  void InsertNeuron(UINT i, UINT j);
68 }; //CNeuralNet
69 
70 #endif
int GetState()
Get neuron state.
Definition: NeuralNet.cpp:43
void SetOutput(bool b)
Set neuron output.
Definition: NeuralNet.cpp:73
bool GetOutput()
Get neuron output.
Definition: NeuralNet.cpp:66
Useful includes.
Neuron in a Hopfield network.
Definition: NeuralNet.h:41
Hopfield network.
Definition: NeuralNet.h:64
int m_nState
Neuron state.
Definition: NeuralNet.h:43
unsigned int UINT
Abbreviation for unsigned integer.
Definition: Defines.h:84
Undirected multi-graph.
Definition: Graph.h:102
CNeuron(CVertex *p0, CVertex *p1, UINT index)
Constructor.
Definition: NeuralNet.cpp:36
void SetState(int n)
Get neuron state.
Definition: NeuralNet.cpp:58
bool IsStable()
Stability test.
Definition: NeuralNet.cpp:51
Graph vertex.
Definition: Graph.h:70
CNeuralNet(UINT n, int seed)
Constructor.
Definition: NeuralNet.cpp:85
Header for the graph CGraph and its vertices CVertex and edges CEdge.
Header for the pseudo-random number generator CRandom.
void InsertNeuron(UINT i, UINT j)
Insert a neuron.
Definition: NeuralNet.cpp:99
Graph edge.
Definition: Graph.h:41
int m_bOutput
Neuron output.
Definition: NeuralNet.h:45
int m_nOldState
Old neuron state.
Definition: NeuralNet.h:44