Module mutation
source code
mutation
Contains strongly-typed version of the Koza-based mutation
operator.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author:
by Mehdi Khoury
Version:
1.20
Copyright:
(c) 2009 Mehdi Khoury under the mit license
http://www.opensource.org/licenses/mit-license.html
Contact:
mehdi.khoury at gmail.com
|
Mutate(maxdepth,
parent,
p1_map,
p1_depth)
create a mutated individual from a parent tree using Koza styled
mutation |
source code
|
|
Function: Mutate
create a mutated individual from a parent tree using Koza styled
mutation
- Parameters:
maxdepth - maximum depth of the mutated offspring
parent - parent tree e.g.
a=buildtree.buildTree().AddHalfNode((0,2,'root'),0,2,7)
p1_map - parent tree index mapping e.g
a_map=crossutil.get_indices_mapping_from_tree(a)
p1_depth - parent tree depth e.g.
a_depth=crossutil.get_depth_from_indices_mapping(a_map)
- Returns:
- a tuple containing two elements.
-
The first one is a boolean indicating if the mutated tree is
identical to the parent (if identical, returns True)
-
The second one is the mutated tree
|