-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnection.h
More file actions
51 lines (48 loc) · 1.36 KB
/
Connection.h
File metadata and controls
51 lines (48 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#ifndef CONNECTION_H
#define CONNECTION_H
#include <iostream>
class Connection
{
private:
bool disable;
int nodeToIdx;
int nodeFromIdx;
int innovationNumber;
public:
double weight;
Connection();
Connection(int innovationNumber, int nodeFromIdx, int nodeToIdx, bool disable = false) : innovationNumber(innovationNumber), nodeFromIdx(nodeFromIdx), nodeToIdx(nodeToIdx), disable(disable) {};
Connection(const Connection &conn);
int getnodeToIdx() const;
bool isDisable() const;
int getnodeFromIdx() const;
//double getWeight();
//void updateWeight(const double &val);
//void setWeight(double weight);
~Connection();
friend class Individu;
friend class NEAT;
bool operator ==(const Connection &obj) {
return (disable == obj.disable) && (nodeToIdx == obj.nodeToIdx) && (nodeFromIdx == obj.nodeFromIdx) && (weight == obj.weight) && (innovationNumber == obj.innovationNumber);
}
friend std::ostream & operator << (std::ostream &out, const Connection &obj)
{
out << obj.disable << "\n";
out << obj.weight << "\n";
out << obj.nodeToIdx << "\n";
out << obj.nodeFromIdx << "\n";
out << obj.innovationNumber << "\n";
return out;
};
friend std::istream & operator >> (std::istream &in, Connection &obj)
{
in >> obj.disable;
in >> obj.weight;
in >> obj.nodeToIdx;
in >> obj.nodeFromIdx;
in >> obj.innovationNumber;
return in;
};
};
#endif