pygx.algo.evolution.mutators¶
Mutators for evolutionary algorithms.
mutators
¶
Mutators for evolutionary algorithms.
Uniform
¶
Bases: Mutator
Mutates a DNA by randomizing a branch of the DNA.
This is a minimal mutator. It acts as follows. PyGX represents a DNA as a tree, with information at each node, where child nodes are conditional on the value of parent nodes. This mutator will pick a node uniformly at random and mutate the subtree rooted at that node (inclusive), respecting dependencies specified in the DNASpec.
However, in general, we recommend that you write your own Mutator subclass so you can tailor it to your search space. This would allow you, for example: i) to modify a value drawing from a custom distribution: e.g. a gaussian-distributed additive change may be more appropriate in many cases. ii) to choose a node in the tree with a non-uniform distribution. E.g. you may want to modify some nodes more frequently if they encode areas of the space that should be explored more thoroughly. iii) perform mutations that implement a different type of locality than that represented by the tree structure. E.g. if two nodes at the same level need to be modified in a coordinated way.
Source code in pygx/algo/evolution/_mutators.py
mutate
¶
Mutates the DNA at a given step.
Source code in pygx/algo/evolution/_mutators.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
Swap
¶
Bases: Mutator
Specialized mutator that swaps DNA branches rooted at sibling nodes.
Source code in pygx/algo/evolution/_mutators.py
mutate
¶
Mutates the DNA. If impossible, returns a clone.
Source code in pygx/algo/evolution/_mutators.py
options: show_root_heading: false show_root_toc_entry: false members_order: source heading_level: 2