예제 #1
0
    def __init__(self,
                 autoFitness=True,
                 randomize=True,
                 mother=False,
                 father=False):
        self.config = config.Config()
        self.lights = [[], []]

        for i in range(0, len(self.config.LIGHTSID)):
            if (randomize):
                self.lights[i].append(self.generateCromossome())
            else:
                self.lights[i].append(
                    self.crossCromossome(mother.getCromossome(i),
                                         father.getCromossome(i)))

        mutate = (float(random.randrange(0, 100)) / 100)

        if (mutate <= self.config.MUTATIONRATE):
            self.mutateMyself()

        for i in range(0, len(self.config.LIGHTSID)):
            self.lights[i].append(self.calculateTime(self.lights[i][0]))
            self.lights[i].append(self.config.CYCLE_TIME - self.lights[i][1])

        self.fitness = fitness.Fitness(self)
        self.score = 0.0

        if (autoFitness):
            self.evaluateYourself()
            self.lights.append(self.score)
#!/usr/bin/env python3

import argparse

import fitness
import quarantine

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    args = parser.parse_args()

    PROVISIONER = "terraform-packet"
    WORKER_TYPE = "gecko-t-linux"

    f = fitness.Fitness(log_level=0, provisioner=PROVISIONER, alert_percent=85)
    q = quarantine.Quarantine()

    q.print_quarantined_workers(PROVISIONER, WORKER_TYPE)
    f.simple_worker_report(WORKER_TYPE, worker_count=70)
예제 #3
0
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from numpy import random
import fitness

#variables! Select type of fitness + which dataset
modelType = 'secondOrder'
dataSet = 'folk'
fit = fitness.Fitness(modelType, dataSet)


def mutateRandom(mlength=12, nrOfTones=12):
    # define the length of the melody
    mlength = 12
    nrOfTones = 12

    # instantiate some necessary variables
    bestscore = 0
    melody = random.randint(0, nrOfTones, mlength)
    bestmelody = list(melody)
    progress = []
    mutaterange = range(nrOfTones)

    #each loop decreases the number of mutations per round
    for i in range(0, 5):
        #each loop mutates the currentbest, checks it's fitness and updates currentbest
        for x in range(0, 1000):
            melody = list(bestmelody)