This is a small project inspired by Grammatical Evolution.
It's a Genetic Algorithm that evolves a Program-Code.
(in fact i'd prefer to call it Code-Evolution, since it involves even ROM and uses RAM, and since Grammatical Evolution is something more sophisticated)
The GA individuals-Structure is this:
-Inputs
-Outpus
-RAM
-ROM (Constants)
-Code
The Parts that evolve are ROM and CODE.
Public Sub INIT(PopulationSize As Long, Inputs As Long, Outputs As Long, Rams As Long, Roms As Long, NCodeLines As Long, _
EVOSonsPerc As Double, EVOChildMutationProb As Double, EVOMutationRate As Double)
At the Moment the CODE have this set of instructions:
R = A + B
R = A - B
R = A * B
R = A / B
R = A ^ B
R = IIf(A > B, A, B) Greater
R = IIf(A < B, A, B) Smaller
R = A
JUMP to line Code
Jump if A>B to line Code
Jump if A<B to line Code
Where A,B can be: Input,RAM,ROM
and R can be RAM,Output
One single line of code occupy 7 Values defined so:
1 - Main instruction
2 - Type of A
3 - Address of A (depending on its type)
4 - Type of B
5 - Address of B (depending on its type)
6 - Type of R
7 - Address of R (depending on its type)
(If 1 operand or jump,some of these are not used)
Launch the program and watch moving object learn to stay on "Green Circle"
In Test01 a set of Object move according to their Codes.
They have 2 imputs:
Difference of Angle to GreenCircle
Distance to GreenCircle
2 output:
Speed
Turn Angle
It has been written quickly and still a lot to improve.
By the way, I'd like to share this on Github or GitLab... cause I'd like to have contributors and new test tasks-designer.
I tried both, but both gives me error when I download the code and try to open it with VB6. Can someone tell me why?
If you have improvements or test-tasks designed.. Share!
It's a Genetic Algorithm that evolves a Program-Code.
(in fact i'd prefer to call it Code-Evolution, since it involves even ROM and uses RAM, and since Grammatical Evolution is something more sophisticated)
The GA individuals-Structure is this:
-Inputs
-Outpus
-RAM
-ROM (Constants)
-Code
The Parts that evolve are ROM and CODE.
Public Sub INIT(PopulationSize As Long, Inputs As Long, Outputs As Long, Rams As Long, Roms As Long, NCodeLines As Long, _
EVOSonsPerc As Double, EVOChildMutationProb As Double, EVOMutationRate As Double)
At the Moment the CODE have this set of instructions:
R = A + B
R = A - B
R = A * B
R = A / B
R = A ^ B
R = IIf(A > B, A, B) Greater
R = IIf(A < B, A, B) Smaller
R = A
JUMP to line Code
Jump if A>B to line Code
Jump if A<B to line Code
Where A,B can be: Input,RAM,ROM
and R can be RAM,Output
One single line of code occupy 7 Values defined so:
1 - Main instruction
2 - Type of A
3 - Address of A (depending on its type)
4 - Type of B
5 - Address of B (depending on its type)
6 - Type of R
7 - Address of R (depending on its type)
(If 1 operand or jump,some of these are not used)
Launch the program and watch moving object learn to stay on "Green Circle"
In Test01 a set of Object move according to their Codes.
They have 2 imputs:
Difference of Angle to GreenCircle
Distance to GreenCircle
2 output:
Speed
Turn Angle
It has been written quickly and still a lot to improve.
By the way, I'd like to share this on Github or GitLab... cause I'd like to have contributors and new test tasks-designer.
I tried both, but both gives me error when I download the code and try to open it with VB6. Can someone tell me why?
If you have improvements or test-tasks designed.. Share!