The program gen_03.exe is designed to search for a program in the Fort language that implements the algorithm specified using a test file of the form:
#T SHIFTR_0 x,y → x*2^y comment <in> 9 3 </in><out> 1536 </out> <in> 4 3 </in><out> 48 </out> <in> 2 7 </in><out> 28 </out> <in> 3 3 </in><out> 24 </out> <in> 6 5 </in><out> 320 </out> <in> 2 5 </in><out> 20 </out> <in> 7 5 </in><out> 640 </out> ...You can read more about the language and methods used in this article "Генетические алгоритмы" in arxiv.org.
gen_03.exe command [аргументы]
Possible commands:
Argument, example | Description |
---|---|
test=test000.tst | Specify a test file. If the test parameter is not specified, it is considered equal to test.tst. |
Len=12 или L=12 | Specify lenght (commands SearchQ, SearchM) |
L1=14 | Another length (command searchP) |
Freq=ProbB1.csw | To specify a file with a table of frequencies (needed in commands SearchQ, SearchM). Files of the required type (ProbA.csv, Prob.csv) are created after the commands SearchL, SearchT, SearchP. Pay attention to the list of words. The list of words with which the file is built must match the current list of words. |
admit=adm01.adm | A list of valid and additional words. If the admin parameter is not specified, no additional words are considered and all available words are valid. Example: : F01 DUP -- ; IF CONST DUP DROP SWAP OVER ROT -ROT + - * =0 -- F01или : F01 DUP -- ; : F02 DUP -- * DUP ; IF CONST DUP DROP SWAP OVER ROT -ROT * ++ -- F01 F02In the probabilistic search, the list of valid words is not needed, everything is determined by the frequency table. However, the file may still be required if additional words are used. |
stSize=8 | Size of Fort-stack for a program. Default stSize=16. |
maxTm=8 | Maximal time for a program (in commands). Default maxTm=80. |
nPart=100 | The number of partial progmams. Defaule nPart=400. |
Kind=1 | The use of conditional jumps in the program:
|
When executing the command SearchA (search of admited words) search results are written to the prot.txt file of the form:
gen:admFind, find admited words for test SHIFTR_0 gen:admFind, The result of full search till length 8 in files result01.txt, Freq00.csv. Next - random search with a length of 7 to 14: gen:admFind, The frequency of the words turned out to be: GOTO IF CONST DUP DROP SWAP OVER ROT -ROT PICK 2PICK 3PICK 4PICK ROLL 3ROLL 4ROLL NEG + - * / % %/ AND OR XOR > < = 0= 0> 0< ++ -- 64 915 218 751 194 544 671 200 162 38 38 38 38 38 38 40 38 439 630 333 38 42 38 38 38 38 38 38 78 42 38 40 44 42 Admited words: 1 2 3 4 5 6 7 8 9 18 19 20 29 GOTO IF CONST DUP DROP SWAP OVER ROT -ROT + - * =
Example of the usage:
gen_03.exe SearchP 800 admit=adm_ff.adm test=..\tests\FACTORIAL_0.tst Kind=3
After the programs run, the files in the current directory:
max.tests: 3, mid per 1 mill.: 681.90 Histogramm: 0: 1090240739 1: 405654 2: 169059 3: 20 Executed tests: N number of execut. 0: 0 1: 0 2: 493800 3: 223540 4: 19963 5: 5677 6: 742 7: 95 8: 15 9: 0 10: 0 The best programs: Length, number of tests, program Best( 2, 2) ++ -- ; Best( 3, 2) -- >0 ++ ; Best( 4, 2) ++ ++ -- -- ; Best( 5, 2) CONST -2 - -- -- ; Best( 6, 3) DUP -- * DUP =0 XOR ; Most frequent substrings: Freq= 39,L= 2: =0 OR ; Freq= 39,L= 2: =0 XOR ; Freq= 36,L= 2: <0 OR ; Freq= 37,L= 2: <0 XOR ; Freq= 4,L= 3: CONST 12 /% ; Freq= 4,L= 3: CONST 12 =0 ; Freq= 4,L= 3: CONST 12 <0 ; Freq= 4,L= 3: DUP -- DUP ; Freq= 4,L= 3: DUP -- * ; Freq= 5,L= 3: OVER % ++ ; Freq= 5,L= 3: % ++ * ; Freq= 3,L= 4: DUP -- DUP =0 ; Freq= 3,L= 4: DUP -- * DUP ; Freq= 5,L= 4: OVER % ++ * ; Freq= 3,L= 4: -- * DUP =0 ; Freq= 3,L= 5: DUP -- * DUP =0 ; Words freq: 1 GOTO 248 2 IF 494 3 CONST 314 4 DUP 453 5 DROP 125 6 SWAP 168 7 OVER 126 ... Partial programs and the number of tests for each of them: 2: ++ -- ; 2: -- ++ ; 2: DUP XOR ; 2: DUP AND ; 2: NEG NEG ; 2: DUP DROP ; 2: -- >0 ++ ; 2: DUP <0 XOR ; 2: DUP =0 XOR ; ...