Exemplo n.º 1
0
    def Breed(self, other):

        p1 = random.randint(0, len(other.p) - 1)
        # p1 = 0
        p2 = random.randint(0, len(other.p) - 1)
        child = INDIVIDUAL(1)  # This only sets up the framework of the child

        geneImprint = MatrixCreate(len(other.p[p1].genome),
                                   len(other.p[p1].genome[0]))
        geneImprint = MatrixRandomize(geneImprint)

        childGenome = other.p[p1].genome * geneImprint
        childGenome += other.p[p2].genome * np.logical_not(geneImprint)

        child.genome = childGenome

        return child
Exemplo n.º 2
0
import numpy as np
import math
import pip
import pyrosim
import random
import copy
import pickle
from snakeservo import ROBOT
from individual import INDIVIDUAL
from population import POPULATION

genvector = np.genfromtxt('bestind.txt', dtype='float')
print genvector

indbest = INDIVIDUAL(0)
indbest.genome = genvector
print indbest.genome
indbest.Start_Evaluation(False)