tabuada
所属分类:人工智能/神经网络/深度学习
开发工具:C
文件大小:11KB
下载次数:0
上传日期:2019-11-20 01:33:51
上 传 者:
sh-1993
说明: 遗传编程综合汇编程序
(Genetic programming synthesize assembler programs)
文件列表:
AUTHORS (26, 2018-03-02)
COPYING (0, 2018-03-02)
INSTALL (0, 2018-03-02)
NEWS (0, 2018-03-02)
src (0, 2018-03-02)
src\Makefile (141, 2018-03-02)
src\fitextern (10892, 2018-03-02)
src\fitexternal.c (2876, 2018-03-02)
src\fitexternal.h (187, 2018-03-02)
src\fitmult.c (2105, 2018-03-02)
src\fitmult.h (177, 2018-03-02)
src\gp.c (8404, 2018-03-02)
src\gp.h (731, 2018-03-02)
src\machine.c (3985, 2018-03-02)
src\machine.h (629, 2018-03-02)
This project is a little toy in genetic programming. Basically we built a system that uses genetic programming to synthesize code into a tiny virtual machine.
To play you need of:
- gcc
* Building
In the src directory, execute the command:
$ make
* Testing
Run without changes, the gp program try synthesize a program that does the multiplication of two integers. Note that the virtual machine has no instruction of multiplication. Use this command for see the program in action:
$./gp -n 20 -t 50000000 -i 10 -H 30
* Instructions of Virtual Machine
| instruction | note |
|--------------+--------------------------------------------------------|
| MOVE x y | put the value of y in x |
| MOVI x num | put the value num in x |
| ADD x y | adds the value of y at x |
| SUBI x num | decreases the value num at x |
| JUMPZ x pc | if x value is zero, jump to instruction in position pc |
| JUMP pc | jump to instruction in position pc |
| RET | stop the program |
* Examples of output
#+BEGIN_SRC
MOVE 2 0
SUBI 1 1
JUMPZ 1 8
ADD 2 0
JUMP 1
MOVE 0 1
JUMPZ 2 1
MOVE 0 2
RET
#+END_SRC
Another example (very strange/good):
#+BEGIN_SRC
MOVE 2 0
ADD 1 1
MOVE 2 0
JUMPZ 2 5
SUBI 1 2
JUMPZ 1 9
SUBI 1 2
ADD 0 2
JUMP 5
SUBI 1 3
SUBI 2 12
JUMPZ 0 3
MOVE 2 0
RET
#+END_SRC
* Author
Trumae
近期下载者:
相关文件:
收藏者: