Browse Source

Enable optional exponential mutation count

Yann Weber 6 years ago
parent
commit
79abfd35ab
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      gte/__main__.py

+ 7
- 1
gte/__main__.py View File

@@ -60,6 +60,9 @@ parser_evolve.add_argument('--max-generation', '-G', type=int, metavar='N',
60 60
 
61 61
 parser_evolve.add_argument('--log-progs', '-L', type=str, metavar='FILENAME',
62 62
                            default=None)
63
+parser_evolve.add_argument('--exp-mutate', '-E', action='store_const',
64
+                           default=False, const=True,
65
+                           help="If True make 2**copy_num mutation")
63 66
 
64 67
 parser_evolve.add_argument('--quiet', '-q', action='store_const',
65 68
                            default=False, const=True)
@@ -148,7 +151,10 @@ if 'pool_size' in args:
148 151
         for prog in [ prog for _, prog in scores[:len(scores)//keep_div]]:
149 152
             progs.append(prog)
150 153
             for cur_mut in range(keep_div - 1):
151
-                progs.append(mutate(prog, force=True, mutcount= 2**cur_mut))
154
+                if args.exp_mutate:
155
+                    progs.append(mutate(prog, force=True, mutcount=2**cur_mut))
156
+                else:
157
+                    progs.append(mutate(prog, force=True, mutcount=1))
152 158
                 if len(progs) >= args.pool_size:
153 159
                     break
154 160
             if len(progs) >= args.pool_size:

Loading…
Cancel
Save