chromsome.py 461 Bytes
# -*- coding: utf-8 -*-
"""
Created on Thu May 10 16:49:45 2018

@author: Olav
"""
import numpy as np

class Chromosome:
    fitness = 0
    gene = np.array
    
    def __init__(self, _gene):
        self.gene = _gene

    def __repr__(self):
        return 'Gene: ' + str(self.gene) + ' Fitness: ' + str(self.fitness)
    
    def geneAt(self, index):
        return self.gene[index]
    
    def geneSet(self, index, value):
        self.gene[index] = value