-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.GARule
100 lines (72 loc) · 3.02 KB
/
README.GARule
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
The following is one of my proposal of how GARule using integers.
From GALib documentation on GAs, rules are not necessarily in bits or boolean,
if we have integer or real fields within each rule, we just have to make sure
when we apply "crossover" operations, we do not crossover real and integer fields.
We only do int-to-int and/or real-to-real, but not real-to-int.
By using integers and real numbers, then we can describe the distance of friend(s)
and opponent(s) in our rules. I listed some thoughts about the rule below.
1. Each GARule consists of:
TeamBall, Opponent, Friend, Wall, Net, Ball, Actions
TeamBall - the flag of which team has the ball ==> offense or defense
Opponent - information about where Opponent is, we can figure out what if
there are multiple opponent within range.
Friend - information about where teammate is
Wall - information about where the wall is
Net - information about where the net is (guessing more likely)
Ball - information about where the ball is
Actions - what action to take place.
2. GARule Class Example:
// to describe objects other than itself
struct obstacle{
uint distance;
direction dir;
// possible with known mass
};
class GARule{
public:
GARule();
~GARule();
//private:
bool TeamBall;
obstacle Opponent;
obstacle Friend;
obstacle Wall;
obstacle Net;
obstacle Ball;
bool Actions[6];
};
Note: the direction object may not be well suitable here since
it only has 8 different values. We may (or should) change the direction
to integers with range from 0 to 359. In all operations, we can use only
every 45, however to describe obstacle, we need to use all degrees.
Another thing is, I take out the "private:" since our actual algorithm
needs to copy and modify these rules during crossover and mutation.
3. Rule Example:
When {Opponent, Friend, Wall}.distance = 0, it means the object does
not exist within range. When Ball.distance = 0, it means the bot has
it. (As we agreed before, Ball.distance and Net.distance are not limited
to SensorRange.)
Diagram:
=net=
=fri=
=opp=
=me=
GARule r1;
r1.TeamBall = true;
r1.Friend.distance = 20;
r1.Friend.dir = NW;
r1.Opponent.distance = 10;
r1.Opponent.dir = NE;
r1.Wall.distance = 0;
r1.Wall.dir = N;
r1.Net.distance = 50;
r1.Net.dir = NE;
r1.Ball.distance = 0;
r1.Ball.dir = N;
Actions = {0,1,0,1,0,0}; // {shoot, pass, carry, change dir, intercept, charge}
4. Since we are using integer, mutation operations requires random integer function.
Also each mutation should have range limits. (i.e. if Sensor Range of each bot
is 50, then the Opponent.distance is an element of [1, 50] because the sensor
cannot find obstacles further than 50.)
Please tell me what you think ASAP. I need to get this over my head and start
making the evolving, mutation, and crossover functions.