├── src ├── brain │ ├── __init__.py │ └── NN.py ├── util │ ├── __init__.py │ ├── music.py │ ├── rttl.py │ └── storage.py ├── evolution │ ├── __init__.py │ ├── genome.py │ ├── operators.py │ └── manager.py ├── constants.py ├── yedek.txt ├── main.py └── res │ └── gui.glade ├── .gitignore ├── samples ├── evolution9-51-0.mid ├── evolution9-51-1.mid ├── evolution9-51-2.mid ├── evolution9-51-5.mid └── evolution9-51-7.mid ├── .project ├── .pydevproject ├── input ├── metallica.txt └── beatles.txt ├── COPYING ├── README └── save └── yeni-3-3 /src/brain/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/util/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/evolution/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | data/* 2 | output/* 3 | midi/* 4 | *.pyc 5 | *.swp 6 | -------------------------------------------------------------------------------- /samples/evolution9-51-0.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cagatay/Evolution-9/HEAD/samples/evolution9-51-0.mid -------------------------------------------------------------------------------- /samples/evolution9-51-1.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cagatay/Evolution-9/HEAD/samples/evolution9-51-1.mid -------------------------------------------------------------------------------- /samples/evolution9-51-2.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cagatay/Evolution-9/HEAD/samples/evolution9-51-2.mid -------------------------------------------------------------------------------- /samples/evolution9-51-5.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cagatay/Evolution-9/HEAD/samples/evolution9-51-5.mid -------------------------------------------------------------------------------- /samples/evolution9-51-7.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cagatay/Evolution-9/HEAD/samples/evolution9-51-7.mid -------------------------------------------------------------------------------- /src/constants.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Oct 10, 2010 3 | 4 | @author: cagatay.yuksel 5 | ''' 6 | 7 | SQLITE_FILE = "../data/evolution9.db" 8 | OUTPUT_DIR = "../output/" 9 | INPUT_DIR = "../inputs/" 10 | SAVE_DIR = "../save/" 11 | MIDI_FILE = '../midi/Ultimate.SF2' 12 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Evolution-9 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.pydevproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | python 6 | python 2.6 7 | 8 | /Evolution-9/src 9 | 10 | 11 | -------------------------------------------------------------------------------- /input/metallica.txt: -------------------------------------------------------------------------------- 1 | idisappear:d=4,o=5,b=125:d#.,f#,2a#.,8p,8a#,8a#,a#,g#.,8p,8a#,8a#,a#,g#,8a#,8g#,f#,f#,8d#,d#.,f#,2a#.,8p,8a#,8a#,a#,g#.,8p,8a#,8a#,a#,g#,8a#,8g#,f#,f#,g#,g#,a#,b,c#6,d#6,8g#,a#.,p,a#.,c#6,8c#6,d#6,d#.6,c#6,a#,2g#,8p,8a#,8a#,a#,g#,8a#,8g#,f#,f#,d# 2 | Vibrations:d=8,o=6,b=125:f#.,e,16d#,c#.,f#.5,g#.5,a#.5,4c#.,f#.,e,16d#,c#.,f#.5,g#.5,a#.5,4c#.,f#.,e,16d#,c#.,f#.5,g#.5,a#.5,4c#.,f#.,e,16d#,c#.,f#.5,g#.5,a#.5,c#.,4c.7,4c#.7,4d#7,g#.,g#.,4a#,1c7,4p,4d.7,4d#.7,4f7,a#.,a#.,4c7,2d.7 -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | this is our bs project which aims to create songs like the ones by the beatles (by 'like' i simply mean 'as catchy as') using genetic programming and artificial neural networks and no human interaction at all during evaluation process. It has a GTK gui to track the process and play the results. 2 | 3 | if anybody here is interested in the idea or thinks it's viable, please contact us. we don't have crazy results yet, but there's still a lot to do. 4 | 5 | CONTRIBUTIONS (IN ANY WAY) ARE HIGHLY APPRECIATED, especially on neural networks and music theory which we miserably suck at. 6 | 7 | (i know code is a mess now, sorry) 8 | 9 | 10 | requirements: 11 | python 2.6 (strictly) 12 | pybrain (and its own requirements) 13 | mingus 14 | pyevolve 15 | pygtk 16 | 17 | installation: 18 | python 2.6 http://www.python.org/download 19 | pybrain http://pybrain.org/pages/download (make sure that you installed SciPy and Numpy) 20 | mingus http://code.google.com/p/mingus/downloads/list 21 | pyevolve http://pyevolve.sourceforge.net/intro.html#downloads 22 | -------------------------------------------------------------------------------- /src/util/music.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | from mingus.containers.Note import Note 4 | 5 | note_range = ['P', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#'] 6 | duration_range = [str(2**x) for x in range(6)] 7 | octave_range = [str(x) for x in range(4, 8)] 8 | 9 | class note(object): 10 | def __init__(self, note, octave, duration): 11 | self.note = str(note) 12 | self.octave = '' if octave is None else octave 13 | self.duration = duration 14 | self.mingus_duration = int(duration) 15 | 16 | if self.note == 'P': 17 | self.mingus_note = None 18 | else: 19 | self.mingus_note = Note(self.note, int(self.octave)) 20 | 21 | def int_tuple(self): 22 | return (float(int(self.mingus_note))/1000 if self.mingus_note else 1, -1*float(self.mingus_duration)/1000) 23 | 24 | def __str__(self): 25 | return self.duration + self.note + self.octave 26 | 27 | def random_note(): 28 | return note(random.choice(note_range), 29 | random.choice(octave_range), 30 | random.choice(duration_range)) 31 | -------------------------------------------------------------------------------- /src/evolution/genome.py: -------------------------------------------------------------------------------- 1 | from util import rttl 2 | from mingus.containers.Track import Track 3 | 4 | class song(object): 5 | def __init__(self, 6 | genome, 7 | evolution, 8 | generation, 9 | individual_id, 10 | parent_1 = '', 11 | parent_2 = '', 12 | grade = 0.0, 13 | status = 'created'): 14 | 15 | 16 | self.evolution = evolution 17 | self.generation = generation 18 | self.parent_1 = parent_1 19 | self.parent_2 = parent_2 20 | self.grade = grade 21 | self.status = status 22 | self.individual_id = individual_id 23 | 24 | self.set_genome(genome) 25 | 26 | self.mingus_track = Track() 27 | 28 | for n in self.note_list: 29 | self.mingus_track.add_notes(n.mingus_note, n.mingus_duration) 30 | 31 | self.name = self.evolution + '-' + str(self.generation) + '-' + str(self.individual_id) 32 | return 33 | 34 | @property 35 | def selected(self): 36 | return self.status == 'selected' 37 | 38 | def set_genome(self, genome): 39 | if type(genome) is list: 40 | self.note_list = genome 41 | self.genome = rttl.dump(genome) 42 | 43 | elif type(genome) is unicode: 44 | self.genome = genome 45 | self.note_list = rttl.parse(genome) 46 | 47 | self.int_list = rttl.to_int(self.note_list) 48 | 49 | -------------------------------------------------------------------------------- /src/util/rttl.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on 12 Ara 2010 3 | 4 | @author: melih 5 | ''' 6 | 7 | from util.music import note 8 | 9 | def parse(rttl_string): 10 | rttl_string = rttl_string.strip() 11 | track = [] 12 | parts = rttl_string.split(":") 13 | defaults = parts[1] 14 | notes = parts[2] 15 | 16 | if defaults: 17 | defaults = defaults.split(",") 18 | defaultDuration = defaults[0].split("=")[1] 19 | defaultOctave = defaults[1].split("=")[1] 20 | 21 | notes = notes.split(",") 22 | for n in notes: 23 | n = n.strip().upper() 24 | if defaults: 25 | duration = defaultDuration 26 | octave = defaultOctave 27 | if n[0].isdigit(): 28 | if n[1].isdigit(): 29 | duration = n[:2] 30 | n = n[2:] 31 | else: 32 | duration = n[0] 33 | n = n[1:] 34 | if n[len(n) - 1].isdigit(): 35 | octave = n[len(n) - 1] 36 | n = n[0:len(n) - 1] 37 | if n.endswith("."): 38 | n = n[0:len(n) - 1] 39 | 40 | track.append(note(n, octave, duration)) 41 | return track 42 | 43 | def dataset_from_file(file_uri): 44 | ds_file = file(file_uri) 45 | ds_list = [] 46 | 47 | for line in ds_file: 48 | track = parse(line) 49 | ds_list.append(to_int(track)) 50 | 51 | return ds_list 52 | 53 | def dump(note_list): 54 | out = '::' 55 | 56 | for note in note_list: 57 | out += str(note) + ',' 58 | 59 | return out.rstrip(',') 60 | 61 | def to_int(note_list): 62 | return [x.int_tuple() for x in note_list] 63 | -------------------------------------------------------------------------------- /src/evolution/operators.py: -------------------------------------------------------------------------------- 1 | import random 2 | from util import music 3 | 4 | GENOME_LENGTH = 20 5 | 6 | ############################################################################## 7 | # Shortcuts 8 | ############################################################################## 9 | 10 | r = lambda x: random.randint(0, x) 11 | 12 | def r2(x): 13 | while(True): 14 | point_1 = r(x) 15 | point_2 = r(x) 16 | 17 | if point_1 != point_2: 18 | break 19 | 20 | if point_1 > point_2: 21 | point_1, point_2 = point_2, point_1 22 | 23 | return point_1, point_2 24 | 25 | ############################################################################## 26 | # Generators 27 | ############################################################################## 28 | 29 | def random_gene(): 30 | return music.random_note() 31 | 32 | def random_genome(): 33 | genome = [] 34 | 35 | for i in xrange(GENOME_LENGTH): 36 | genome.append(random_gene()) 37 | 38 | return genome 39 | 40 | ############################################################################## 41 | # Crossover operators 42 | ############################################################################## 43 | 44 | def one_point_crossover(father, mother): 45 | point = r(GENOME_LENGTH -1) 46 | 47 | child_1 = father[:point] + mother[point:] 48 | child_2 = mother[:point] + father[point:] 49 | 50 | return child_1, child_2 51 | 52 | def two_point_crossover(father, mother): 53 | point_1, point_2 = r2(GENOME_LENGTH - 1) 54 | 55 | child_1 = father[:point_1] + mother[point_1:point_2] + father[point_2:] 56 | child_2 = mother[:point_1] + father[point_1:point_2] + mother[point_2:] 57 | 58 | return child_1, child_2 59 | 60 | def uniform_crossover(father, mother): 61 | pool = father + mother 62 | random.shuffle(pool) 63 | 64 | return pool[:GENOME_LENGTH], pool[GENOME_LENGTH:] 65 | 66 | ############################################################################## 67 | # Mutation operators 68 | ############################################################################## 69 | 70 | def swap_mutation(genome): 71 | point_1, point_2 = r2(GENOME_LENGTH - 1) 72 | 73 | genome[point_1], genome[point_2] = genome[point_2], genome[point_1] 74 | 75 | def replace_mutation(genome): 76 | point = r(GENOME_LENGTH - 1) 77 | genome[point] = random_gene() 78 | 79 | def scramble_mutation(genome): 80 | point_1, point_2 = r2(GENOME_LENGTH - 1) 81 | 82 | temp = genome[point_1:point_2] 83 | random.shuffle(temp) 84 | 85 | genome[point_1:point_2] = temp 86 | 87 | def inversion_mutation(genome): 88 | point_1, point_2 = r2(GENOME_LENGTH - 1) 89 | 90 | temp = genome[point_1:point_2] 91 | temp.reverse() 92 | genome[point_1:point_2] = temp 93 | 94 | crossover_operators = [one_point_crossover, two_point_crossover, uniform_crossover] 95 | mutation_operators = [swap_mutation, replace_mutation, scramble_mutation, inversion_mutation] 96 | 97 | random_crossover = lambda x, y: random.choice(crossover_operators)(x, y) 98 | random_mutator = lambda x: random.choice(mutation_operators)(x) 99 | -------------------------------------------------------------------------------- /src/brain/NN.py: -------------------------------------------------------------------------------- 1 | from pybrain.supervised.trainers import BackpropTrainer 2 | from pybrain.datasets import SupervisedDataSet 3 | from pybrain.tools.shortcuts import buildNetwork 4 | import constants 5 | import pickle 6 | import math 7 | from pybrain.auxiliary import GradientDescent 8 | from pybrain.structure import RecurrentNetwork, LinearLayer, SigmoidLayer, FullConnection 9 | import random 10 | from util import rttl 11 | import math 12 | 13 | class neural_network(object): 14 | def __init__(self, name, dataset, trained, store): 15 | self.name = name 16 | self.store = store 17 | self.trained = trained 18 | self.dataset = dataset 19 | 20 | self.net = RecurrentNetwork() 21 | self.net.addInputModule(LinearLayer(2, name='in')) 22 | self.net.addModule(SigmoidLayer(3, name='hidden')) 23 | self.net.addOutputModule(LinearLayer(2, name='out')) 24 | self.net.addConnection(FullConnection(self.net['in'], self.net['out'], name='c1')) 25 | self.net.addConnection(FullConnection(self.net['hidden'], self.net['out'], name='c2')) 26 | self.net.addRecurrentConnection(FullConnection(self.net['hidden'], self.net['hidden'], name='c3')) 27 | self.net.sortModules() 28 | ''' 29 | self.net = buildNetwork(2, 3, 2) 30 | ''' 31 | if not self.trained: 32 | self.train() 33 | 34 | return 35 | 36 | def save(self): 37 | self.store.save_neural_network(self.name, self.dataset, self.trained) 38 | return 39 | 40 | @classmethod 41 | def get_saved(cls, name, store): 42 | result = store.get_neural_network(name) 43 | 44 | return cls(name, result[0], result[1], store) if result else None 45 | 46 | @classmethod 47 | def get_list(cls, store): 48 | result = store.get_neural_network_list() 49 | print result 50 | return [x for x in result] 51 | 52 | @classmethod 53 | def new(cls, name, store, ds_file_uri): 54 | dataset = rttl.dataset_from_file(ds_file_uri) 55 | 56 | store.new_neural_network(name, dataset) 57 | return 58 | 59 | def evaluate(self, genome): 60 | err = 0.0 61 | for i in range(len(genome) - 1): 62 | print '---------- input ------------' 63 | print genome[i] 64 | output = self.net.activate(genome[i]) 65 | print '--------- output ------------' 66 | print output 67 | target = genome[i + 1] 68 | err += (math.fabs(output[0] - target[0]) + math.fabs(output[1] - target[1])) 69 | 70 | return 1/err 71 | 72 | def train(self): 73 | ds_store = [] 74 | for song in self.dataset: 75 | ds_in = song[:len(song) - 1] 76 | ds_out = song[1:] 77 | 78 | ds = SupervisedDataSet(2, 2) 79 | 80 | for i in range(len(song) -1): 81 | #if ds_in[i] not in ds_store: 82 | ds.addSample(ds_in[i], ds_out[i]) 83 | ds_store.append(ds_in[i]) 84 | 85 | if len(ds): 86 | trainer = BackpropTrainer(self.net, ds, verbose=True) 87 | trainer.trainUntilConvergence() 88 | self.save() 89 | -------------------------------------------------------------------------------- /input/beatles.txt: -------------------------------------------------------------------------------- 1 | hardday:d=4,o=5,b=180:8c#,8d,8c#,e,p,e,8p,e,p,8e,8e,8d,8e,g,p,8e,8d,8e,c#,p,8c#,8d,8c#,e,p,e,8p,e,p,8e,8e,8d,8e,g,p,8e,8d,8e,c# 2 | Love:d=8,o=6,b=180:d,d,d,d,4d,2p,d,d,d,d,4d,2p,d,d,d#,4e,p,4b5,2p,a5,b5,a5,g5,4g5 3 | Chance:d=4,o=6,b=180:e,d,c,d,g5,2p,g5,f,e,d,c,p,e,d,c,d,g5,2p,g5,f,e,d,c 4 | Help:d=8,o=5,b=125:b,b,b,b,b,b,b,4b,4b,b,b,d6,b,a,p,4g,4p,4a#,4b,4a,4b,4b,a#,b,b,b,c6,c6,c6,c6,b,p 5 | jude:d=8,o=5,b=180:g,e,p,e,e,g,a,d,p,p,d,e,f,c,c,c,b,g,a,g,f,4e,p,g,a,a,a,d6,c6,b,b,c6,a,4g,c,d,e,a,a,4g 6 | Madonna:d=8,o=6,b=100:e,4e,16d5,d,16p,16c,4p,e,e,d,16a5,4c,4p,e,e,g,e,a,g,e,4c,p,c,d5,c,2p,e,4e,16d5,d,16p,16c,4p,e,e,d,16a5,4c 7 | letitbe:d=4,o=5,b=112:16g.,8g,g,8g,a,8e,8g,g.,8c6,d.6,e6,8e6,e6,8d6,8d6,8c6,2c6,e6,8e6,f6,8e6,8e6,d.6,8e6,8d6,2c6 8 | do:d=4,o=6,b=180:d,d,8f,g,p,8f,8d,8d,8f,g,p,8f,8d,8d,8f,g,8p,d,e,d,c,e,p,g5,g5,a#5,g5 9 | you:d=8,o=6,b=180:d,e,g,4g,f#,e,p,p,d,e,g,g,f#,e,p,p,d,e,g,4g,p,4f,4p,4e 10 | Fields:d=8,o=5,b=180:b,b,c6,b,g,d,e,a,g,f,f,g,a,d,p,2p,4f,4g,4g#,d,d6,c6,b,a,g#,a,4b,p,b,g,e,p,b,g,d,a,4g 11 | Hand:d=8,o=6,b=180:g,a,g,p,p,f,4e,p,e,g,f,e,d,p,4e,e,e,e,e,b,p 12 | Four:d=8,o=6,b=180:e5,d#5,e5,g5,e5,g5,a5,g5,4c,c,e,c,a5,4d,2p,b5,c,c#,d,b5,c,c#,d,b5,a#5,a5,4a5,4p,4b5,4c,4c#,4d,4e,4d#,d,c,p 13 | Submarine:d=8,o=5,b=180:4d6,4d6,4d6,d6,e6,a,a,a,a,4a,a,a,a,a,4a,p,g,g,g,g,4g 14 | yday:d=4,o=5,b=125:g,8f,f,p,8a,8b,8c#6,8d6,e6,8p,8f6,e6,8d6,d6,p,8d6,8d6,8c6,8a#,8a,8g,8a#,8a,8a,a,8p,g,f,8a,8g,g,8p,8d,f,8p,8a,a 15 | amlife:d=32,o=5,b=100:2a,8c6,8b,8a,g,2e.,8p,a,8a,8a,8c6,8b,8a,g,2e,8p,e,2d,8f,8e,8d,e,2g,8p,e,2d,8f,8e,8d,e,2g,8p,p,2a,8c6,8b,8a,g,2e.,8p,a,8a,8a,8c6,8b,8a,g,2e,8p,e,2d,8f,8e,8d,e,2g,8p,e,2d,8f,8e,8d,e,2g,8p,p 16 | americanpie:d=4,o=5,b=125:8d#,8d#,8d#,8f,8d#,p,2d#,c#,8c#,8c#,8c,8a#4,8g#4,a#4,d#,8d#,8d#,8d#,8d#,8c,8c#,8c#,8c#,8c#,8c,8a#4,8g#4,8d#4,p,8p,8d#,8d#,8f,8p,8c#,8p,8c#,8c#,8c#,8c,8a#4,8g#4,8a#4,p,8c,8a#4,8g#4,8f4,8g#4,16f4,8g#.4,8g4,f4,2a#4 17 | beautifulstranger:d=4,o=5,b=125:8d#,8c#,8b4,1c#,8d#,8c#,8b4,16c#,16p,8c#,8d#,8c,1g#4,8d#,8c#,8b4,c#,8g#.4,16p,1g#4,8d#,8c#,8b4,8c#.,16p,8d#.,16p,8d#.,16p,1c#,8p,8c#,8f,g#,8f#,8f,8f#,f,1c#,8p,8c#,8f,g#,8f#,8f,8f#,f,8d#,8c#,8b4,1c# 18 | Cherish:d=8,o=6,b=160:f,p,e,p,g5,p,4a5,p,c,16c,10p,c,d,10p,16c,5p,e,p,f,p,g,p,4d,p,b5,16b5,5p,b5,32p,c 19 | Dieanother:d=4,o=5,b=200:c6,p,d#6,2d6,a#,p,a#,2p,d#.6,8p,d.6,8p,c6,p,c6,p,d#6,d6,p,a#.,2p,p,8p,d#.6,8p,d.6,8p,c6,p,c6,p,d#6,d6,p,a#.,2p,p,8p,d#6,p,2d6,c6,p,c6,p,d#6,d6,p,a#.,p,8p,a#,p,d#6,d.6,8p,c6,2p,p,8d#6,p,8p,8f6,2p,8p,2f6,2p,8d#.6,16p,f6,8d#.6,16p,2f6,2p,8d#6,p,8p,8f6,2p,8p,2f6,2p,8d#.6,16p,f6,8d#.6 20 | Me:d=4,o=5,b=180:e,e,e,e,f,g,a,g,g,g,a,a,g,8c6,8g,8p,f,e,8p,8e,8f,8g,8d,8d,d,e,f,c,c,8p,8c,8d,8c,8e,8g 21 | express:d=4,o=5,b=112:a,8a,g,a,8f,f,f,g,8f,8g,g,a,8b,g,8f,8f,8f,8f,8g,8a,8g,p,a,8a,g,a,8f,8f,f,8f,8f,8f,8f,8g,8g,8f,a,8b,g. 22 | Fever:d=8,o=6,b=140:d,32p,c,d,32p,c,d,p,a5,32p,4c,4d,2p,d,32p,c,d,32p,c,d,32p,c,a5,32p,4a5,4p,d,32p,c,d,32p,c,d,p,a5,32p,4c,d,2p,a5,a5,p,d,32p,c,d,32p,c,d,32p,c,a5,32p,16a5,5p,a5,16a5,10p,a5,4c,16a 23 | Hollywood:d=4,o=5,b=125:8d6,8e6,g6,e6,16g,16p,8p,16g,16p,8p,16c,16p,8p,16c,16p,8p,16a,16p,8e6,8d6,8e6,8b6,8a6,g6,8e6,d.6,16c,16p,8p,16c,16p,8p,16a,16p,8p,8d6,8e6,g6,e6,16g,16p,d.6,8b,8a,16c,16p,8p,16a,16p,8e6,8d6,8e6,8b6,8a6,8g6,8e6,16g,16p,8p,16g,16p,8p,16c,16p,8p,16c,16p,8p,16a,16p,8p,16a,16p,8p,8g 24 | hungup:d=8,o=5,b=125:g,a,2a.,p,a,4c6,b,g,g,a,4a,4a,a,a,p,2g.,p,4a,g,f,g,f,p,g,p,f,p,2d,p,4a,g,g,p,2f.,p,4g,4g,1d,2p,4g,4g,1d,2p,4g,4g,1d,2p,4g,4g,1d 25 | LAISLA:d=4,o=5,b=200:c#.,g#.4,c#,d#.,g#.4,d#,8e.,d#,2e,2p,2e,2e,2g#,g#,8e,e.,g#,f#.,8e,2d#,c#.,g#.4,c#,d#.,d#.,f#,8e,d#,2e,2p,2e,2e,f#,g#,g#,8e,e.,g#,f#,d#,2d#,p,e,8e,e,e,e,8d#,2d#.,f#,8f#,f#,f#,f#,e,2e.,8d#,d#,d#,e,d#,c#,2c#,8c#,c#,c#.,d#,8e,d#,2e 26 | Virgin:d=8,o=5,b=180:c,d,f,d,p,p,g,g,f,g,g,c6,a,p,p,c,d,a,g,f,g,d,4d,p,f,g,f,d 27 | luvprofu:d=4,o=5,b=125:8e,8e,8e,2f,8p,8e,8p,e,f.,8p,8e,8e,8e,2e,8p,8e,8e,8e,2e,8p,8e,8e,8e,2f,8p,8e,8p,e,f.,8p,8e,8e,8e,2e,8p,8e,8e,8e,16e,16d,c.,8p,8e,8e,8e,2e,8p,8e,8e,8d 28 | MUSIC:d=4,o=5,b=125:d6,8a#,8c6,8p,8c6,p,2p,8g,8g,8g,8g,d6,8a#,8c6,8p,8c6,p,2p,8g,8g,8g,8g,d6,8a#,8c6,8p,8c6,8p,c6,a#,g.,2p,d6,8c6,8a#,c6,a#,8c.6,16c6,8c6,8a#,g,8g,8a#,d6,8c6,8a#,c6,a#,2p,8p,8g,8g,8a#,d6,8a#,8c6,p,8p,8a,8c6,8d6,8c6,8a#,g,8g,8a#,d6,a#,c6,a# 29 | preach:d=8,o=5,b=125:48a#.,10p,a#,a,p,g,2p,a#,4a,4f,g,g,2p,g,g,d6,d6,d6,4c6,4p,d6,4c6,4p,a#,c6,d6,4c6,4a# 30 | Rain:d=8,o=5,b=100:1e6,p,e6,d6,c#6,b,b,a,4a,e6,d6,c#6,b,b,b,b,b,c#6,16a,16a,b,4a,p,1e 31 | Girl:d=8,o=6,b=112:16a#5,c.,d#,2d#,p,4a#,g,4g#,4g.,16f,d#.,d#,2d#,p,16a#5,c.,d#,2d#,p,4a#,g,4g#,4g.,16f,d#.,d#,2d#,p,16a#5,c.,d#,2d 32 | -------------------------------------------------------------------------------- /src/yedek.txt: -------------------------------------------------------------------------------- 1 | 2 | ''' 3 | class NN: 4 | name = "" 5 | net = buildNetwork(1, 1, 1) 6 | inputCount = 1 7 | outputCount = 1 8 | hiddenLayerNodeCount = 20 9 | durationPerNote = 2; 10 | ds = SupervisedDataSet(inputCount, outputCount) 11 | 12 | 13 | def __init__(self, _name, _inputCount, _outputCount, _durationPerNote = 2): 14 | self.name= _name 15 | self.inputCount = _inputCount 16 | self.outputCount = _outputCount 17 | self.durationPerNote = _durationPerNote 18 | self.net = buildNetwork(self.inputCount, self.hiddenLayerNodeCount, self.outputCount) 19 | self.ds = SupervisedDataSet(self.inputCount, self.outputCount) 20 | 21 | def saveNetworkToFile(self): 22 | pickle.dump(self.net, open(constants.SAVE_DIR + self.name + "-" 23 | + str(self.inputCount) + "-" + str(self.outputCount), "w" ) ) 24 | 25 | def readNetworkFromFile(self): 26 | self.net = pickle.load( open(constants.SAVE_DIR + self.name + "-" 27 | + str(self.inputCount) + "-" + str(self.outputCount), "r" ) ) 28 | 29 | def train(self): 30 | # trainer = BackpropTrainer(self.net, self.ds, verbose=True) 31 | 32 | # trainer.trainUntilConvergence() 33 | # for i in range(0,5000): 34 | # trainer.trainEpochs(1) 35 | # print '\tvalue after %d epochs: %.2f'%(i, self.net.activate((64, 4, 64))[0]) 36 | # trainer.trainEpochs(1) 37 | # print '\tvalue after %d epochs: %.2f'%(i, self.net.activate((64, 64, 64))[0]) 38 | # 39 | 40 | 41 | def addSong(self, song): 42 | 43 | song = self.attachIntList( song ) 44 | 45 | 46 | 47 | i = 0 48 | z = 0 49 | 50 | for intNote in song.intList: 51 | 52 | if i + self.inputCount >= len( song.intList ): 53 | break 54 | 55 | sampleList = list() 56 | sampleOutputList = list() 57 | 58 | for j in range( 0, self.inputCount + 1 ): 59 | 60 | if j % self.inputCount == 0 and len( sampleList ) == self.inputCount : 61 | 62 | 63 | if( j + i + self.outputCount < len( song.intList ) ): 64 | 65 | for z in range( j + i , j + i + self.outputCount ): 66 | #sampleOutputList.append( song.intList[ z ] ) 67 | sampleOutputList.append( 1 ) 68 | 69 | self.ds.addSample( sampleList, sampleOutputList ) 70 | 71 | sampleList = list() 72 | sampleOutputList = list() 73 | 74 | else: 75 | sampleList.append( song.intList[ j + i ] ) 76 | 77 | i += 1 78 | 79 | 80 | 81 | def attachIntList(self, song): 82 | currentNoteInt = 0 83 | currentDuration = 0 84 | currentNote = Note() 85 | song.intList = list() 86 | for note in song.notes: 87 | if not note[1]: 88 | currentNote = None 89 | currentNoteInt = 0 90 | currentDuration = note[0] 91 | else: 92 | currentNote = Note(note[1], note[2]) 93 | currentNoteInt = int(Note(note[1], note[2])) 94 | currentDuration = note[0] 95 | 96 | insertedDuration = 0 97 | while insertedDuration < currentDuration: 98 | song.intList.append(currentNoteInt) 99 | insertedDuration += 2 100 | return song 101 | 102 | 103 | def fitness(self, song): 104 | 105 | returnValue = 0.0 106 | 107 | song = self.attachIntList( song ) 108 | 109 | i = 0 110 | z = 0 111 | 112 | for intNote in song.intList: 113 | 114 | if i + self.inputCount >= len( song.intList ): 115 | break 116 | 117 | sampleList = list() 118 | 119 | for j in range( 0, self.inputCount + 1 ): 120 | 121 | if j % self.inputCount == 0 and len( sampleList ) == self.inputCount : 122 | 123 | 124 | if( j + i + self.outputCount < len( song.intList ) ): 125 | 126 | for z in range( j + i , j + i + self.outputCount ): 127 | returnValue += math.fabs( self.net.activate( sampleList )[0] - 1) 128 | 129 | sampleList = list() 130 | 131 | else: 132 | sampleList.append( song.intList[ j + i ] ) 133 | 134 | i += 1 135 | 136 | 137 | return returnValue 138 | ''' 139 | -------------------------------------------------------------------------------- /src/util/storage.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Created on Oct 11, 2010 3 | 4 | @author: melih.karci 5 | ''' 6 | 7 | from constants import SQLITE_FILE 8 | import sqlite3 9 | import json 10 | 11 | class db: 12 | _connection = None 13 | 14 | def __init__(self): 15 | self._connection = sqlite3.connect(SQLITE_FILE) 16 | c = self._cursor 17 | 18 | # Create neural networks table 19 | c.execute(''' 20 | CREATE TABLE IF NOT EXISTS neural_networks( 21 | name TEXT PRIMARY KEY ON CONFLICT REPLACE, 22 | dataset TEXT, 23 | trained BOOLEAN 24 | ); 25 | ''') 26 | 27 | # Create evolutions table 28 | c.execute(''' 29 | CREATE TABLE IF NOT EXISTS evolutions( 30 | name TEXT PRIMARY KEY ON CONFLICT REPLACE, 31 | population_size INTEGER, 32 | generation_count INTEGER, 33 | evaluator TEXT, 34 | state TEXT, 35 | FOREIGN KEY(evaluator) REFERENCES neural_networks(name) 36 | ); 37 | ''') 38 | 39 | # create genomes table 40 | c.execute(''' 41 | CREATE TABLE IF NOT EXISTS genomes( 42 | name TEXT PRIMARY KEY ON CONFLICT REPLACE, 43 | genome TEXT, 44 | evolution TEXT, 45 | generation INTEGER, 46 | individual_id, 47 | parent_1 TEXT, 48 | parent_2 TEXT, 49 | grade REAL, 50 | status TEXT, 51 | FOREIGN KEY(evolution) REFERENCES evolutions(name) 52 | ); 53 | ''') 54 | 55 | self._commit() 56 | c.close() 57 | 58 | def _commit(self): 59 | self._connection.commit() 60 | 61 | @property 62 | def _cursor(self): 63 | return self._connection.cursor() 64 | 65 | def close(self): 66 | self._connection.close() 67 | 68 | def save_evolution(self, name, population_size, evaluator, generation_count, state): 69 | c = self._cursor 70 | 71 | c.execute(''' 72 | INSERT INTO evolutions (name, evaluator, population_size, generation_count, state) 73 | VALUES(?, ?, ?, ?, ?); 74 | ''', (name, evaluator, population_size, generation_count, state)) 75 | self._commit() 76 | 77 | c.close() 78 | return 79 | 80 | #Returns evolution for the given row id 81 | def get_evolution(self, name): 82 | c = self._cursor 83 | c.execute(''' 84 | SELECT * FROM evolutions WHERE name=? 85 | ''', [name]) 86 | 87 | result = c.fetchall() 88 | c.close() 89 | 90 | return result[0] if result else None 91 | 92 | def get_evolution_list(self): 93 | c = self._cursor 94 | c.execute(''' 95 | SELECT name FROM evolutions 96 | ''') 97 | 98 | result = c.fetchall() 99 | c.close() 100 | 101 | return result 102 | 103 | def new_neural_network(self, name, dataset): 104 | c = self._cursor 105 | 106 | c.execute(''' 107 | INSERT INTO neural_networks (name, dataset, trained) 108 | VALUES(?, ?, ?); 109 | ''', (name, json.dumps(dataset), 0)) 110 | self._commit() 111 | 112 | c.close() 113 | return 114 | 115 | def save_neural_network(self, name, dataset, trained): 116 | c = self._cursor 117 | 118 | c.execute(''' 119 | UPDATE neural_networks SET name=?, trained=? WHERE name=?; 120 | ''', (name, int(trained), json.dumps(dataset))) 121 | 122 | self._commit() 123 | c.close() 124 | 125 | return 126 | 127 | def get_neural_network(self, name): 128 | c = self._cursor 129 | 130 | c.execute(''' 131 | SELECT dataset, trained from neural_networks WHERE name=?; 132 | ''', [name]) 133 | 134 | result = c.fetchall()[0] 135 | 136 | c.close() 137 | 138 | return json.loads(result[0]), bool(result[1]) 139 | 140 | def get_neural_network_list(self): 141 | c = self._cursor 142 | c.execute(''' 143 | SELECT name FROM neural_networks 144 | ''') 145 | 146 | result = c.fetchall() 147 | c.close() 148 | 149 | return [x[0] for x in result] 150 | 151 | def get_genomes(self, evolution, generation): 152 | c = self._cursor 153 | c.execute(''' 154 | SELECT * FROM genomes WHERE evolution=? AND generation=? AND status <> ? ORDER BY individual_id ASC 155 | ''', [evolution, generation, 'eliminated']) 156 | 157 | result = c.fetchall() 158 | c.close() 159 | 160 | return result 161 | 162 | def save_genome(self, 163 | name, 164 | genome, 165 | evolution, 166 | generation, 167 | individual_id, 168 | parent_1, 169 | parent_2, 170 | grade, 171 | status): 172 | 173 | c = self._cursor 174 | c.execute(''' 175 | INSERT INTO genomes(name, 176 | genome, 177 | evolution, 178 | generation, 179 | individual_id, 180 | parent_1, 181 | parent_2, 182 | grade, 183 | status) 184 | VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?); 185 | ''', (name, 186 | genome, 187 | evolution, 188 | generation, 189 | individual_id, 190 | parent_1, 191 | parent_2, 192 | grade, 193 | status)) 194 | 195 | self._commit() 196 | 197 | c.close() 198 | return 199 | -------------------------------------------------------------------------------- /src/evolution/manager.py: -------------------------------------------------------------------------------- 1 | from brain.NN import neural_network 2 | from evolution import operators 3 | from evolution.genome import song 4 | 5 | class evolution(object): 6 | def __init__(self, name, evaluator, population_size, store, generation_count = 0, state='uninitialized'): 7 | self.store = store 8 | self.name = name 9 | self.evaluator = neural_network.get_saved(evaluator, store) 10 | self.population_size = population_size 11 | self.generation_count = generation_count 12 | self.state = state 13 | if self.state != 'uninitialized': 14 | self.get_current_generation() 15 | else: 16 | self.current_generation = None 17 | 18 | self.save() 19 | 20 | def save(self): 21 | self.store.save_evolution(self.name, 22 | self.population_size, 23 | self.evaluator.name, 24 | self.generation_count, 25 | self.state) 26 | return 27 | 28 | def save_genomes(self): 29 | for g in self.current_generation: 30 | self.store.save_genome(g.name, 31 | g.genome, 32 | g.evolution, 33 | g.generation, 34 | g.individual_id, 35 | g.parent_1, 36 | g.parent_2, 37 | g.grade, 38 | g.status) 39 | return 40 | 41 | @classmethod 42 | def get_saved(cls, name, store): 43 | result = store.get_evolution(name) 44 | 45 | return cls(result[0], result[3], result[1], store, result[2], result[4]) if result else None 46 | 47 | @classmethod 48 | def get_list(cls, store): 49 | result = store.get_evolution_list() 50 | 51 | return [x[0] for x in result] if result else None 52 | 53 | def initialize(self, console = None): 54 | self.current_generation = [] 55 | 56 | for i in xrange(self.population_size): 57 | g = song(operators.random_genome(), self.name, 0, i) 58 | self.current_generation.append(g) 59 | 60 | self.state = 'evaluate' 61 | self.save_genomes() 62 | self.save() 63 | 64 | if console: 65 | console('%s is initialized'%self.name) 66 | return 67 | 68 | @property 69 | def initialized(self): 70 | return self.state != 'uninitialized' 71 | 72 | def get_current_generation(self): 73 | result = self.store.get_genomes(self.name, self.generation_count) 74 | 75 | if result: 76 | self.current_generation = [] 77 | 78 | for i in result: 79 | g = song(i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) 80 | self.current_generation.append(g) 81 | 82 | return 83 | 84 | def get_generation(self, generation): 85 | result = self.store.get_genomes(self.name, generation) 86 | 87 | if result: 88 | self.searched_generation = [] 89 | 90 | for i in result: 91 | g = song(i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) 92 | self.searched_generation.append(g) 93 | 94 | def evaluate(self, console = None): 95 | self.results = [] 96 | for g in self.current_generation: 97 | result = self.evaluator.evaluate(g.int_list) 98 | g.grade = result 99 | if console: 100 | console('%s evaluation result: %f'%(g.name, result)) 101 | 102 | self.current_generation = sorted(self.current_generation, key=lambda x: x.grade, reverse=True) 103 | 104 | self.max_grade = self.current_generation[0].grade 105 | self.min_grade = self.current_generation[len(self.current_generation) - 1].grade 106 | self.avg_grade = sum([x.grade for x in self.current_generation])/self.population_size 107 | 108 | for i in range(self.population_size): 109 | if i < self.population_size/2: 110 | self.current_generation[i].status = 'selected' 111 | else: 112 | self.current_generation[i].status = 'eliminated' 113 | self.state = 'select' 114 | 115 | if console: 116 | console('Generation %d of %s : evaluation complete'%(self.generation_count, self.name)) 117 | return 118 | 119 | def apply_selection(self, console = None): 120 | self.save_genomes() 121 | 122 | self.current_generation = self.current_generation[:self.population_size/2] 123 | self.state = 'reproduce' 124 | 125 | self.save() 126 | 127 | console('%s : applied selection on generation %d'%(self.name, self.generation_count)) 128 | 129 | return 130 | 131 | def reproduce(self, console = None): 132 | self.generation_count += 1 133 | 134 | console('%s : reproducing of generation %d started'%(self.name, self.generation_count)) 135 | 136 | pool = [] 137 | 138 | index = 0 139 | while self.current_generation: 140 | l = len(self.current_generation) - 1 141 | 142 | if not l: 143 | break 144 | 145 | a = operators.r(l) 146 | 147 | parent_1 = self.current_generation[a] 148 | del self.current_generation[a] 149 | 150 | a = operators.r(l - 1) 151 | parent_2 = self.current_generation[a] 152 | 153 | del self.current_generation[a] 154 | 155 | child_1_g, child_2_g = operators.random_crossover(parent_1.note_list, 156 | parent_2.note_list) 157 | operators.random_mutator(child_1_g) 158 | operators.random_mutator(child_2_g) 159 | 160 | parent_1.individual_id = index 161 | parent_1.status = 'created' 162 | parent_1.generation = self.generation_count 163 | parent_1.grade = 0.0 164 | index += 1 165 | 166 | parent_2.individual_id = index 167 | parent_2.status = 'created' 168 | parent_2.generation = self.generation_count 169 | parent_2.grade = 0.0 170 | index += 1 171 | 172 | child_1 = song(child_1_g, 173 | self.name, 174 | self.generation_count, 175 | index, 176 | parent_1.name, 177 | parent_2.name) 178 | index += 1 179 | 180 | child_2 = song(child_2_g, 181 | self.name, 182 | self.generation_count, 183 | index, 184 | parent_1.name, 185 | parent_2.name) 186 | index += 1 187 | 188 | t = parent_1.note_list 189 | operators.random_mutator(t) 190 | parent_1.set_genome(t) 191 | 192 | t = parent_2.note_list 193 | operators.random_mutator(t) 194 | parent_2.set_genome(t) 195 | 196 | pool += [parent_1, parent_2, child_1, child_2] 197 | 198 | console('created %s and %s from %s and %s'%(child_1.name, child_2.name, parent_1.name, parent_2.name)) 199 | 200 | self.current_generation = pool 201 | 202 | self.save() 203 | self.save_genomes() 204 | self.state = 'evaluate' 205 | console('%s : created generation %d'%(self.name, self.generation_count)) 206 | 207 | -------------------------------------------------------------------------------- /src/main.py: -------------------------------------------------------------------------------- 1 | 2 | #!/usr/bin/python2.6 3 | import sys, traceback 4 | import gtk 5 | from brain.NN import neural_network 6 | from evolution.manager import evolution 7 | from mingus.midi import fluidsynth 8 | from util.storage import db 9 | from constants import MIDI_FILE 10 | 11 | class evolution9_app(object): 12 | def __init__(self): 13 | self.store = db() 14 | fluidsynth.init(MIDI_FILE, 'alsa') 15 | 16 | self.builder = gtk.Builder() 17 | self.builder.add_from_file('res/gui.glade') 18 | 19 | self.window = self.builder.get_object('window') 20 | self.new_evolution_dialog = self.builder.get_object('new_evolution_dialog') 21 | self.new_neural_network_dialog = self.builder.get_object('new_neural_network_dialog') 22 | self.open_evolution_dialog = self.builder.get_object('open_evolution_dialog') 23 | 24 | 25 | self.nn_list = gtk.ListStore(str) 26 | self.nn_combo = self.builder.get_object('nn_combo') 27 | self.nn_combo.set_model(self.nn_list) 28 | cell = gtk.CellRendererText() 29 | self.nn_combo.pack_start(cell, True) 30 | self.nn_combo.add_attribute(cell,'text', 0) 31 | 32 | self.update_nn_list() 33 | 34 | self.evolution_list = gtk.ListStore(str) 35 | self.evolution_combo = self.builder.get_object('evolution_combo') 36 | self.evolution_combo.set_model(self.evolution_list) 37 | cell = gtk.CellRendererText() 38 | self.evolution_combo.pack_start(cell, True) 39 | self.evolution_combo.add_attribute(cell, 'text', 0) 40 | 41 | self.update_evolution_list() 42 | 43 | self.genome_list = gtk.ListStore(int, str) 44 | self.genome_view = self.builder.get_object('genome_view') 45 | self.genome_view.set_model(self.genome_list) 46 | cell = gtk.CellRendererText() 47 | column = gtk.TreeViewColumn('Genome', cell, text=1) 48 | self.genome_view.append_column(column) 49 | 50 | self.controls = { 51 | 'initialize': self.builder.get_object('initialize_button'), 52 | 'evaluate': self.builder.get_object('evaluate_button'), 53 | 'select' : self.builder.get_object('apply_selection_button'), 54 | 'play' : self.builder.get_object('play_button') 55 | } 56 | 57 | self.console = gtk.TextBuffer() 58 | self.builder.get_object('console').set_buffer(self.console) 59 | 60 | # hide dialogs instead of destroying them for reuse 61 | self.hide_dialog = gtk.Widget.hide_on_delete 62 | 63 | self.builder.connect_signals(self) 64 | 65 | def log_console(self, text): 66 | self.console.insert_at_cursor(text + '\n') 67 | self.builder.get_object('console').scroll_to_mark(self.console.get_insert(), 0) 68 | 69 | 70 | def start_evolution(self): 71 | if self.evolution9.initialized: 72 | self.controls['initialize'].set_label('Reproduce') 73 | else: 74 | self.controls['initialize'].set_label('Initialize') 75 | self.update_state() 76 | self.update_genome_list() 77 | 78 | self.log_console('%s is started'%self.evolution9.name) 79 | 80 | #self.builder.get_object('generation_info_tab').set_sensitive(True) 81 | def update_state(self): 82 | for k, v in self.controls.iteritems(): 83 | v.set_sensitive(False) 84 | 85 | if self.evolution9: 86 | if not self.evolution9.initialized or self.evolution9.state == 'reproduce': 87 | self.controls['initialize'].set_sensitive(True) 88 | elif self.evolution9.state == 'evaluate': 89 | self.controls['evaluate'].set_sensitive(True) 90 | elif self.evolution9.state == 'select': 91 | self.controls['select'].set_sensitive(True) 92 | 93 | self.builder.get_object('step_50_button').set_sensitive(True) 94 | 95 | def error_message(self, message): 96 | dialog = gtk.MessageDialog(None, 97 | gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, 98 | gtk.MESSAGE_ERROR, 99 | gtk.BUTTONS_OK, 100 | message) 101 | dialog.run() 102 | dialog.destroy() 103 | 104 | def on_window_destroy(self, widget, data = None): 105 | gtk.main_quit() 106 | 107 | def show_individual_info(self, treeview, path, view_column, *args): 108 | index = path[0] 109 | individual = self.evolution9.current_generation[index] 110 | fixed_grade = "%.5f" % ( individual.grade ) 111 | 112 | self.builder.get_object('name_label').set_text(individual.name) 113 | self.builder.get_object('parent1_label').set_text(individual.parent_1) 114 | self.builder.get_object('parent2_label').set_text(individual.parent_2) 115 | self.builder.get_object('grade_label').set_text( fixed_grade ) 116 | self.builder.get_object('selected_label').set_text(str(individual.selected)) 117 | 118 | self.controls['play'].set_sensitive(True) 119 | 120 | def main(self): 121 | self.window.show() 122 | gtk.main() 123 | 124 | def update_evolution_list(self): 125 | self.evolution_list.clear() 126 | evolutions = evolution.get_list(self.store) 127 | 128 | if evolutions: 129 | for e in evolutions: 130 | self.evolution_combo.append_text(e) 131 | 132 | return 133 | 134 | def update_nn_list(self): 135 | self.nn_list.clear() 136 | networks = neural_network.get_list(self.store) 137 | 138 | if networks: 139 | for n in networks: 140 | self.nn_combo.append_text(n) 141 | 142 | return 143 | 144 | def update_genome_list(self): 145 | self.genome_list.clear() 146 | l = self.evolution9.current_generation 147 | 148 | if l: 149 | for x in range(len(l)): 150 | self.genome_list.append((x, l[x].genome)) 151 | return 152 | 153 | def on_step_50_button_clicked(self, *args): 154 | if not self.evolution9.initialized: 155 | self.evolution9.initialize() 156 | if self.evolution9.state == 'evaluate': 157 | self.evolution9.evaluate(self.log_console) 158 | if self.evolution9.state == 'select': 159 | self.evolution9.apply_selection(self.log_console) 160 | 161 | for _ in range(50): 162 | self.evolution9.reproduce(self.log_console) 163 | self.evolution9.evaluate(self.log_console) 164 | self.evolution9.apply_selection(self.log_console) 165 | 166 | self.update_state() 167 | self.update_genome_list() 168 | self.update_generation_info() 169 | 170 | return 171 | 172 | def on_new_evolution_ok_button_clicked(self, *args): 173 | name = self.builder.get_object('new_evolution_name').get_text() 174 | population_size = self.builder.get_object('new_evolution_pop_size').get_text() 175 | evaluator = self.builder.get_object('nn_combo').get_active_text() 176 | 177 | try: 178 | self.evolution9 = evolution(name, evaluator, int(population_size), self.store) 179 | except Exception, err: 180 | self.error_message(str(err)) 181 | traceback.print_exc(file=sys.stdout) 182 | else: 183 | self.new_evolution_dialog.hide() 184 | self.start_evolution() 185 | 186 | def on_open_evolution_button_clicked(self, *args): 187 | self.open_evolution_dialog.present() 188 | return 189 | 190 | def on_apply_selection_button_clicked(self, *args): 191 | self.evolution9.apply_selection(self.log_console) 192 | self.update_genome_list() 193 | self.update_state() 194 | 195 | def on_new_neural_network_button_clicked(self, *args): 196 | self.new_neural_network_dialog.present() 197 | 198 | def on_new_neural_network_ok_button_clicked(self, *args): 199 | nn_name = self.builder.get_object('new_nn_name').get_text() 200 | ds_file_uri = self.builder.get_object('new_nn_dataset_file').get_filename() 201 | 202 | try: 203 | neural_network.new(nn_name, self.store, ds_file_uri) 204 | except Exception, err: 205 | self.error_message(str(err)) 206 | traceback.print_exc(file=sys.stdout) 207 | else: 208 | self.log_console('created neural network : %s' % nn_name) 209 | self.update_nn_list() 210 | self.new_neural_network_dialog.hide() 211 | 212 | def on_new_evolution_button_clicked(self, *args): 213 | self.new_evolution_dialog.present() 214 | return 215 | 216 | def on_open_evolution_ok_button_clicked(self, *args): 217 | name = self.builder.get_object('evolution_combo').get_active_text() 218 | 219 | try: 220 | self.evolution9 = evolution.get_saved(name, self.store) 221 | except Exception, err: 222 | self.error_message(str(err)) 223 | traceback.print_exc(file=sys.stdout) 224 | else: 225 | self.start_evolution() 226 | self.open_evolution_dialog.hide() 227 | 228 | def on_evaluate_button_clicked(self, *args): 229 | self.evolution9.evaluate(self.log_console) 230 | self.update_genome_list() 231 | self.update_state() 232 | self.update_generation_info() 233 | return 234 | 235 | def update_generation_info(self): 236 | 237 | max_grade = "%.5f" % ( self.evolution9.max_grade ) 238 | min_grade = "%.5f" % ( self.evolution9.min_grade ) 239 | avg_grade = "%.5f" % ( self.evolution9.avg_grade ) 240 | 241 | self.builder.get_object('max_grade_label').set_text(max_grade) 242 | self.builder.get_object('min_grade_label').set_text(min_grade) 243 | self.builder.get_object('average_grade_label').set_text(avg_grade) 244 | 245 | def reproduce(self, *args): 246 | self.evolution9.reproduce(self.log_console) 247 | self.update_state() 248 | self.update_genome_list() 249 | 250 | def on_initialize_button_clicked(self, *args): 251 | if self.evolution9.initialized: 252 | self.reproduce(*args) 253 | else: 254 | self.evolution9.initialize(self.log_console) 255 | self.controls['initialize'].set_label('Reproduce') 256 | self.update_state() 257 | self.update_genome_list() 258 | 259 | def on_play_button_clicked(self, *args): 260 | index = self.genome_view.get_selection().get_selected()[1] 261 | index = self.genome_list.get_path(index)[0] 262 | fluidsynth.play_Track(self.evolution9.current_generation[index].mingus_track) 263 | 264 | if __name__ == '__main__': 265 | app = evolution9_app() 266 | app.main() 267 | -------------------------------------------------------------------------------- /save/yeni-3-3: -------------------------------------------------------------------------------- 1 | ccopy_reg 2 | _reconstructor 3 | p0 4 | (cpybrain.structure.networks.feedforward 5 | FeedForwardNetwork 6 | p1 7 | c__builtin__ 8 | object 9 | p2 10 | Ntp3 11 | Rp4 12 | (dp5 13 | S'indim' 14 | p6 15 | I3 16 | sS'modulesSorted' 17 | p7 18 | (lp8 19 | g0 20 | (cpybrain.structure.modules.biasunit 21 | BiasUnit 22 | p9 23 | g2 24 | Ntp10 25 | Rp11 26 | (dp12 27 | g6 28 | I0 29 | sS'inputbuffer' 30 | p13 31 | cnumpy.core.multiarray 32 | _reconstruct 33 | p14 34 | (cnumpy 35 | ndarray 36 | p15 37 | (I0 38 | tp16 39 | S'b' 40 | p17 41 | tp18 42 | Rp19 43 | (I1 44 | (I1 45 | I0 46 | tp20 47 | cnumpy 48 | dtype 49 | p21 50 | (S'f8' 51 | p22 52 | I0 53 | I1 54 | tp23 55 | Rp24 56 | (I3 57 | S'<' 58 | p25 59 | NNNI-1 60 | I-1 61 | I0 62 | tp26 63 | bI00 64 | S'' 65 | p27 66 | tp28 67 | bsS'outputerror' 68 | p29 69 | g14 70 | (g15 71 | (I0 72 | tp30 73 | g17 74 | tp31 75 | Rp32 76 | (I1 77 | (I1 78 | I1 79 | tp33 80 | g24 81 | I00 82 | S'\x00\x00\x00\x00\x00\x00\x00\x00' 83 | p34 84 | tp35 85 | bsS'inputerror' 86 | p36 87 | g14 88 | (g15 89 | (I0 90 | tp37 91 | g17 92 | tp38 93 | Rp39 94 | (I1 95 | (I1 96 | I0 97 | tp40 98 | g24 99 | I00 100 | g27 101 | tp41 102 | bsS'outputbuffer' 103 | p42 104 | g14 105 | (g15 106 | (I0 107 | tp43 108 | g17 109 | tp44 110 | Rp45 111 | (I1 112 | (I1 113 | I1 114 | tp46 115 | g24 116 | I00 117 | S'\x00\x00\x00\x00\x00\x00\xf0?' 118 | p47 119 | tp48 120 | bsS'_name' 121 | p49 122 | S'bias' 123 | p50 124 | sS'argdict' 125 | p51 126 | (dp52 127 | S'name' 128 | p53 129 | g50 130 | ssS'outdim' 131 | p54 132 | I1 133 | sS'offset' 134 | p55 135 | I0 136 | sS'bufferlist' 137 | p56 138 | (lp57 139 | (g13 140 | I0 141 | tp58 142 | a(g36 143 | I0 144 | tp59 145 | a(g42 146 | I1 147 | tp60 148 | a(g29 149 | I1 150 | tp61 151 | asbag0 152 | (cpybrain.structure.modules.linearlayer 153 | LinearLayer 154 | p62 155 | g2 156 | Ntp63 157 | Rp64 158 | (dp65 159 | g6 160 | I3 161 | sg13 162 | g14 163 | (g15 164 | (I0 165 | tp66 166 | g17 167 | tp67 168 | Rp68 169 | (I1 170 | (I1 171 | I3 172 | tp69 173 | g24 174 | I00 175 | S'\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@' 176 | p70 177 | tp71 178 | bsS'dim' 179 | p72 180 | I3 181 | sg29 182 | g14 183 | (g15 184 | (I0 185 | tp73 186 | g17 187 | tp74 188 | Rp75 189 | (I1 190 | (I1 191 | I3 192 | tp76 193 | g24 194 | I00 195 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 196 | p77 197 | tp78 198 | bsg36 199 | g14 200 | (g15 201 | (I0 202 | tp79 203 | g17 204 | tp80 205 | Rp81 206 | (I1 207 | (I1 208 | I3 209 | tp82 210 | g24 211 | I00 212 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 213 | p83 214 | tp84 215 | bsg42 216 | g14 217 | (g15 218 | (I0 219 | tp85 220 | g17 221 | tp86 222 | Rp87 223 | (I1 224 | (I1 225 | I3 226 | tp88 227 | g24 228 | I00 229 | S'\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@' 230 | p89 231 | tp90 232 | bsg49 233 | S'in' 234 | p91 235 | sg51 236 | (dp92 237 | g72 238 | I3 239 | sg53 240 | g91 241 | ssg54 242 | I3 243 | sg55 244 | I0 245 | sg56 246 | (lp93 247 | (g13 248 | I3 249 | tp94 250 | a(g36 251 | I3 252 | tp95 253 | a(g42 254 | I3 255 | tp96 256 | a(g29 257 | I3 258 | tp97 259 | asbag0 260 | (cpybrain.structure.modules.sigmoidlayer 261 | SigmoidLayer 262 | p98 263 | g2 264 | Ntp99 265 | Rp100 266 | (dp101 267 | g6 268 | I6 269 | sg13 270 | g14 271 | (g15 272 | (I0 273 | tp102 274 | g17 275 | tp103 276 | Rp104 277 | (I1 278 | (I1 279 | I6 280 | tp105 281 | g24 282 | I00 283 | S'\xb2\xa3\xb0\xde\xb9$b@\xe4\x99%:\xf6,t@\xf3K\x97D5\x106\xc0\xe3\x90\xbbE\xa8\xd1p@\x96\xf2)\xaaU`\xb7@\xfd\x99\xbf\xfb\xa6\x19`\xc0' 284 | p106 285 | tp107 286 | bsg72 287 | I6 288 | sg29 289 | g14 290 | (g15 291 | (I0 292 | tp108 293 | g17 294 | tp109 295 | Rp110 296 | (I1 297 | (I1 298 | I6 299 | tp111 300 | g24 301 | I00 302 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 303 | p112 304 | tp113 305 | bsg36 306 | g14 307 | (g15 308 | (I0 309 | tp114 310 | g17 311 | tp115 312 | Rp116 313 | (I1 314 | (I1 315 | I6 316 | tp117 317 | g24 318 | I00 319 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 320 | p118 321 | tp119 322 | bsg42 323 | g14 324 | (g15 325 | (I0 326 | tp120 327 | g17 328 | tp121 329 | Rp122 330 | (I1 331 | (I1 332 | I6 333 | tp123 334 | g24 335 | I00 336 | S'\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?O\xfb\xa1\xab8\xfe\xf1=\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?\x906\xa4O\x8a\x1bR4' 337 | p124 338 | tp125 339 | bsg49 340 | S'hidden0' 341 | p126 342 | sg51 343 | (dp127 344 | g72 345 | I6 346 | sg53 347 | g126 348 | ssg54 349 | I6 350 | sg55 351 | I0 352 | sg56 353 | (lp128 354 | (g13 355 | I6 356 | tp129 357 | a(g36 358 | I6 359 | tp130 360 | a(g42 361 | I6 362 | tp131 363 | a(g29 364 | I6 365 | tp132 366 | asbag0 367 | (g62 368 | g2 369 | Ntp133 370 | Rp134 371 | (dp135 372 | g6 373 | I3 374 | sg13 375 | g14 376 | (g15 377 | (I0 378 | tp136 379 | g17 380 | tp137 381 | Rp138 382 | (I1 383 | (I1 384 | I3 385 | tp139 386 | g24 387 | I00 388 | S")\xb4\x9b\x80\xcc\x13M@\xe2\x1b'M\xc6\xefI@\x08\x11\x19:+\xcbI@" 389 | p140 390 | tp141 391 | bsg72 392 | I3 393 | sg29 394 | g14 395 | (g15 396 | (I0 397 | tp142 398 | g17 399 | tp143 400 | Rp144 401 | (I1 402 | (I1 403 | I3 404 | tp145 405 | g24 406 | I00 407 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 408 | p146 409 | tp147 410 | bsg36 411 | g14 412 | (g15 413 | (I0 414 | tp148 415 | g17 416 | tp149 417 | Rp150 418 | (I1 419 | (I1 420 | I3 421 | tp151 422 | g24 423 | I00 424 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 425 | p152 426 | tp153 427 | bsg42 428 | g14 429 | (g15 430 | (I0 431 | tp154 432 | g17 433 | tp155 434 | Rp156 435 | (I1 436 | (I1 437 | I3 438 | tp157 439 | g24 440 | I00 441 | S")\xb4\x9b\x80\xcc\x13M@\xe2\x1b'M\xc6\xefI@\x08\x11\x19:+\xcbI@" 442 | p158 443 | tp159 444 | bsg49 445 | S'out' 446 | p160 447 | sg51 448 | (dp161 449 | g72 450 | I3 451 | sg53 452 | g160 453 | ssg54 454 | I3 455 | sg55 456 | I0 457 | sg56 458 | (lp162 459 | (g13 460 | I3 461 | tp163 462 | a(g36 463 | I3 464 | tp164 465 | a(g42 466 | I3 467 | tp165 468 | a(g29 469 | I3 470 | tp166 471 | asbasS'inmodules' 472 | p167 473 | (lp168 474 | g64 475 | asg29 476 | g14 477 | (g15 478 | (I0 479 | tp169 480 | g17 481 | tp170 482 | Rp171 483 | (I1 484 | (I1 485 | I3 486 | tp172 487 | g24 488 | I00 489 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 490 | p173 491 | tp174 492 | bsg36 493 | g14 494 | (g15 495 | (I0 496 | tp175 497 | g17 498 | tp176 499 | Rp177 500 | (I1 501 | (I1 502 | I3 503 | tp178 504 | g24 505 | I00 506 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 507 | p179 508 | tp180 509 | bsS'_derivs' 510 | p181 511 | g14 512 | (g15 513 | (I0 514 | tp182 515 | g17 516 | tp183 517 | Rp184 518 | (I1 519 | (I45 520 | tp185 521 | g24 522 | I00 523 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 524 | p186 525 | tp187 526 | bsS'modules' 527 | p188 528 | c__builtin__ 529 | set 530 | p189 531 | ((lp190 532 | g64 533 | ag134 534 | ag11 535 | ag100 536 | atp191 537 | Rp192 538 | sg42 539 | g14 540 | (g15 541 | (I0 542 | tp193 543 | g17 544 | tp194 545 | Rp195 546 | (I1 547 | (I1 548 | I3 549 | tp196 550 | g24 551 | I00 552 | S")\xb4\x9b\x80\xcc\x13M@\xe2\x1b'M\xc6\xefI@\x08\x11\x19:+\xcbI@" 553 | p197 554 | tp198 555 | bsg49 556 | S'FeedForwardNetwork-17' 557 | p199 558 | sS'connections' 559 | p200 560 | (dp201 561 | g64 562 | (lp202 563 | g0 564 | (cpybrain.structure.connections.full 565 | FullConnection 566 | p203 567 | g2 568 | Ntp204 569 | Rp205 570 | (dp206 571 | g6 572 | I3 573 | sg54 574 | I6 575 | sS'outSliceFrom' 576 | p207 577 | I0 578 | sS'inSliceTo' 579 | p208 580 | I3 581 | sS'inmod' 582 | p209 583 | g64 584 | sg181 585 | g14 586 | (g15 587 | (I0 588 | tp210 589 | g17 590 | tp211 591 | Rp212 592 | (I1 593 | (I18 594 | tp213 595 | g24 596 | I00 597 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 598 | p214 599 | tp215 600 | bsS'outmod' 601 | p216 602 | g100 603 | sg49 604 | S'FullConnection-13' 605 | p217 606 | sg51 607 | (dp218 608 | g209 609 | g64 610 | sg216 611 | g100 612 | ssS'paramdim' 613 | p219 614 | I18 615 | sS'owner' 616 | p220 617 | g4 618 | sS'outSliceTo' 619 | p221 620 | I6 621 | sS'hasDerivatives' 622 | p222 623 | I01 624 | sS'inSliceFrom' 625 | p223 626 | I0 627 | sS'_params' 628 | p224 629 | g14 630 | (g15 631 | (I0 632 | tp225 633 | g17 634 | tp226 635 | Rp227 636 | (I1 637 | (I18 638 | tp228 639 | g24 640 | I00 641 | S'\xfc\xba2\xa6\xe6\x10\xf2?\x0e\xd8?|xa\xb9\xbf\x89A\x89\xf1\xb3\x06\xf3?\x98o\xb6?\x8cN\xf4?\xbb\xb8\xac\x80\x9c\xf0\xf3?\x89\x15\x90\x02l+\x04@v\xce\nL\x13\x02\xe0?X\xbd\xed\x07\xa4\x9c\xdb?R\xce\xc7\xa4\xdd\x0c\xf5\xbf1\xfbZ\x04d;\x00@a\xc6\xd6\xed\xb2\x12\xbf?\x0cP\xd8\xa2\x14;\x00@\xd5\xde\xbe\xea\xf1;W@\xfc)\xca<\x00o\xba?~\xd8\xdb(\xf0:\xdb?6uH\xe6V\xb0\xde\xbf\xa2\xeeW\xf4\x1e<\xfc\xbf\xabj\x1f\xac]\x13\xd0?' 642 | p229 643 | tp230 644 | bsbasg134 645 | (lp231 646 | sg11 647 | (lp232 648 | g0 649 | (g203 650 | g2 651 | Ntp233 652 | Rp234 653 | (dp235 654 | g6 655 | I1 656 | sg54 657 | I3 658 | sg207 659 | I0 660 | sg208 661 | I1 662 | sg209 663 | g11 664 | sg181 665 | g14 666 | (g15 667 | (I0 668 | tp236 669 | g17 670 | tp237 671 | Rp238 672 | (I1 673 | (I3 674 | tp239 675 | g24 676 | I00 677 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 678 | p240 679 | tp241 680 | bsg216 681 | g134 682 | sg49 683 | S'FullConnection-14' 684 | p242 685 | sg51 686 | (dp243 687 | g209 688 | g11 689 | sg216 690 | g134 691 | ssg219 692 | I3 693 | sg220 694 | g4 695 | sg221 696 | I3 697 | sg222 698 | I01 699 | sg223 700 | I0 701 | sg224 702 | g14 703 | (g15 704 | (I0 705 | tp244 706 | g17 707 | tp245 708 | Rp246 709 | (I1 710 | (I3 711 | tp247 712 | g24 713 | I00 714 | S"\x14\x88m\xe8\xe7y'@j\x8be<\xc8\x9b'@\x9e\xcb\xae\xf0\x9f\xb4&@" 715 | p248 716 | tp249 717 | bsbag0 718 | (g203 719 | g2 720 | Ntp250 721 | Rp251 722 | (dp252 723 | g6 724 | I1 725 | sg54 726 | I6 727 | sg207 728 | I0 729 | sg208 730 | I1 731 | sg209 732 | g11 733 | sg181 734 | g14 735 | (g15 736 | (I0 737 | tp253 738 | g17 739 | tp254 740 | Rp255 741 | (I1 742 | (I6 743 | tp256 744 | g24 745 | I00 746 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 747 | p257 748 | tp258 749 | bsg216 750 | g100 751 | sg49 752 | S'FullConnection-15' 753 | p259 754 | sg51 755 | (dp260 756 | g209 757 | g11 758 | sg216 759 | g100 760 | ssg219 761 | I6 762 | sg220 763 | g4 764 | sg221 765 | I6 766 | sg222 767 | I01 768 | sg223 769 | I0 770 | sg224 771 | g14 772 | (g15 773 | (I0 774 | tp261 775 | g17 776 | tp262 777 | Rp263 778 | (I1 779 | (I6 780 | tp264 781 | g24 782 | I00 783 | S"\xe4\x0b)\xad\x15\xfe\x08@\x9e'\x14\x13#\xd8\xdd?\x89\x98$t\xb5\x13\x04@\x0b+\x90j&!\xfa?\x87\xf7*\x98yh\x04@f\xad@'-\xfc\xf3\xbf" 784 | p265 785 | tp266 786 | bsbasg100 787 | (lp267 788 | g0 789 | (g203 790 | g2 791 | Ntp268 792 | Rp269 793 | (dp270 794 | g6 795 | I6 796 | sg54 797 | I3 798 | sg207 799 | I0 800 | sg208 801 | I6 802 | sg209 803 | g100 804 | sg181 805 | g14 806 | (g15 807 | (I0 808 | tp271 809 | g17 810 | tp272 811 | Rp273 812 | (I1 813 | (I18 814 | tp274 815 | g24 816 | I00 817 | S'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 818 | p275 819 | tp276 820 | bsg216 821 | g134 822 | sg49 823 | S'FullConnection-16' 824 | p277 825 | sg51 826 | (dp278 827 | g209 828 | g100 829 | sg216 830 | g134 831 | ssg219 832 | I18 833 | sg220 834 | g4 835 | sg221 836 | I3 837 | sg222 838 | I01 839 | sg223 840 | I0 841 | sg224 842 | g14 843 | (g15 844 | (I0 845 | tp279 846 | g17 847 | tp280 848 | Rp281 849 | (I1 850 | (I18 851 | tp282 852 | g24 853 | I00 854 | S'\x877,\xf7p?*@\xd6\xa2H\x9eI\xde$@\x08)\x0c\xf5\xcd\x840\xc0E\xf5\x86\x07\x97\xa9#@\x12\xa0*}\xf8\r*@y\xd6\xdeL\xb5\xa9\x14@\xc2r\x93\xd5\xfb8)@`.#\xb6\xacP @\xe0\xafj?eL\xfa?z2O\xcc\xe24"@"^-\xa0\xc5d$@\x99\xd6\x0b\\\x83e\x10\xc0l5lD\xd8\x87"@0}\xb5\xc13\x9e&@]\rQm\x1b\xb2\x03\xc0\x1a\xfc\x93\xa7\x1e\xf6\'@\xba\xa6\n\x94\xc4\xb7\x1e@x\xdf\xe1\xea\xd9\xb2\x11\xc0' 855 | p283 856 | tp284 857 | bsbassS'motherconnections' 858 | p285 859 | (lp286 860 | sg13 861 | g14 862 | (g15 863 | (I0 864 | tp287 865 | g17 866 | tp288 867 | Rp289 868 | (I1 869 | (I1 870 | I3 871 | tp290 872 | g24 873 | I00 874 | S'\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@\x00\x00\x00\x00\x00\x00P@' 875 | p291 876 | tp292 877 | bsg51 878 | (dp293 879 | g53 880 | g199 881 | ssg54 882 | I3 883 | sS'outmodules' 884 | p294 885 | (lp295 886 | g134 887 | asg219 888 | I45 889 | sg56 890 | (lp296 891 | (g13 892 | I3 893 | tp297 894 | a(g36 895 | I3 896 | tp298 897 | a(g42 898 | I3 899 | tp299 900 | a(g29 901 | I3 902 | tp300 903 | asS'sorted' 904 | p301 905 | I01 906 | sS'_Network__offset' 907 | p302 908 | I0 909 | sg222 910 | I01 911 | sg224 912 | g14 913 | (g15 914 | (I0 915 | tp303 916 | g17 917 | tp304 918 | Rp305 919 | (I1 920 | (I45 921 | tp306 922 | g24 923 | I00 924 | S'\x14\x88m\xe8\xe7y\'@j\x8be<\xc8\x9b\'@\x9e\xcb\xae\xf0\x9f\xb4&@\xe4\x0b)\xad\x15\xfe\x08@\x9e\'\x14\x13#\xd8\xdd?\x89\x98$t\xb5\x13\x04@\x0b+\x90j&!\xfa?\x87\xf7*\x98yh\x04@f\xad@\'-\xfc\xf3\xbf\xfc\xba2\xa6\xe6\x10\xf2?\x0e\xd8?|xa\xb9\xbf\x89A\x89\xf1\xb3\x06\xf3?\x98o\xb6?\x8cN\xf4?\xbb\xb8\xac\x80\x9c\xf0\xf3?\x89\x15\x90\x02l+\x04@v\xce\nL\x13\x02\xe0?X\xbd\xed\x07\xa4\x9c\xdb?R\xce\xc7\xa4\xdd\x0c\xf5\xbf1\xfbZ\x04d;\x00@a\xc6\xd6\xed\xb2\x12\xbf?\x0cP\xd8\xa2\x14;\x00@\xd5\xde\xbe\xea\xf1;W@\xfc)\xca<\x00o\xba?~\xd8\xdb(\xf0:\xdb?6uH\xe6V\xb0\xde\xbf\xa2\xeeW\xf4\x1e<\xfc\xbf\xabj\x1f\xac]\x13\xd0?\x877,\xf7p?*@\xd6\xa2H\x9eI\xde$@\x08)\x0c\xf5\xcd\x840\xc0E\xf5\x86\x07\x97\xa9#@\x12\xa0*}\xf8\r*@y\xd6\xdeL\xb5\xa9\x14@\xc2r\x93\xd5\xfb8)@`.#\xb6\xacP @\xe0\xafj?eL\xfa?z2O\xcc\xe24"@"^-\xa0\xc5d$@\x99\xd6\x0b\\\x83e\x10\xc0l5lD\xd8\x87"@0}\xb5\xc13\x9e&@]\rQm\x1b\xb2\x03\xc0\x1a\xfc\x93\xa7\x1e\xf6\'@\xba\xa6\n\x94\xc4\xb7\x1e@x\xdf\xe1\xea\xd9\xb2\x11\xc0' 925 | p307 926 | tp308 927 | bsb. -------------------------------------------------------------------------------- /src/res/gui.glade: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 600 7 | 400 8 | Evolution-9 9 | center 10 | 900 11 | 700 12 | 13 | 14 | 15 | True 16 | vertical 17 | 18 | 19 | True 20 | start 21 | 22 | 23 | New Evolution 24 | True 25 | True 26 | True 27 | 28 | 29 | 30 | False 31 | False 32 | 0 33 | 34 | 35 | 36 | 37 | Open Evolution 38 | True 39 | True 40 | True 41 | 42 | 43 | 44 | False 45 | False 46 | 1 47 | 48 | 49 | 50 | 51 | False 52 | 0 53 | 54 | 55 | 56 | 57 | True 58 | True 59 | vertical 60 | 61 | 62 | True 63 | 64 | 65 | True 66 | 10 67 | vertical 68 | 69 | 70 | True 71 | 72 | 73 | True 74 | start 75 | 76 | 77 | Initialize 78 | True 79 | False 80 | True 81 | True 82 | 83 | 84 | 85 | False 86 | False 87 | 0 88 | 89 | 90 | 91 | 92 | Evaluate generation 93 | True 94 | False 95 | True 96 | True 97 | 98 | 99 | 100 | False 101 | False 102 | 1 103 | 104 | 105 | 106 | 107 | Apply Selection 108 | True 109 | False 110 | True 111 | True 112 | 113 | 114 | 115 | False 116 | False 117 | 2 118 | 119 | 120 | 121 | 122 | False 123 | False 124 | 0 125 | 126 | 127 | 128 | 129 | True 130 | end 131 | 132 | 133 | 50>> 134 | True 135 | False 136 | True 137 | True 138 | 139 | 140 | 141 | False 142 | False 143 | 0 144 | 145 | 146 | 147 | 148 | False 149 | end 150 | 1 151 | 152 | 153 | 154 | 155 | False 156 | 0 157 | 158 | 159 | 160 | 161 | True 162 | 163 | 164 | True 165 | True 166 | 167 | 168 | 169 | False 170 | False 171 | 0 172 | 173 | 174 | 175 | 176 | Get generation 177 | True 178 | False 179 | True 180 | True 181 | 182 | 183 | 184 | False 185 | 1 186 | 187 | 188 | 189 | 190 | False 191 | False 192 | 1 193 | 194 | 195 | 196 | 197 | True 198 | True 199 | automatic 200 | automatic 201 | 202 | 203 | True 204 | True 205 | False 206 | 207 | 208 | 209 | 210 | 211 | 2 212 | 213 | 214 | 215 | 216 | 0 217 | 218 | 219 | 220 | 221 | 300 222 | True 223 | vertical 224 | True 225 | 226 | 227 | True 228 | 0 229 | none 230 | 231 | 232 | True 233 | 12 234 | 235 | 236 | True 237 | vertical 238 | 239 | 240 | True 241 | 5 242 | 2 243 | 244 | 245 | True 246 | 0 247 | 0 248 | Name: 249 | 250 | 251 | GTK_FILL 252 | 253 | 254 | 255 | 256 | True 257 | 0 258 | 0 259 | 260 | 261 | 1 262 | 2 263 | GTK_FILL 264 | 265 | 266 | 267 | 268 | True 269 | 0 270 | 0 271 | Parent 1: 272 | 273 | 274 | 1 275 | 2 276 | GTK_FILL 277 | 278 | 279 | 280 | 281 | True 282 | 0 283 | 0 284 | 285 | 286 | 1 287 | 2 288 | 1 289 | 2 290 | GTK_FILL 291 | 292 | 293 | 294 | 295 | True 296 | 0 297 | 0 298 | Parent 2: 299 | 300 | 301 | 2 302 | 3 303 | GTK_FILL 304 | 305 | 306 | 307 | 308 | True 309 | 0 310 | 0 311 | 312 | 313 | 1 314 | 2 315 | 2 316 | 3 317 | GTK_FILL 318 | 319 | 320 | 321 | 322 | True 323 | 0 324 | 0 325 | Grade: 326 | 327 | 328 | 3 329 | 4 330 | GTK_FILL 331 | 332 | 333 | 334 | 335 | True 336 | 0 337 | 0 338 | 339 | 340 | 1 341 | 2 342 | 3 343 | 4 344 | GTK_FILL 345 | 346 | 347 | 348 | 349 | True 350 | 0 351 | 0 352 | Selected 353 | 354 | 355 | 4 356 | 5 357 | GTK_FILL 358 | 359 | 360 | 361 | 362 | True 363 | 0 364 | 0 365 | 366 | 367 | 1 368 | 2 369 | 4 370 | 5 371 | GTK_FILL 372 | 373 | 374 | 375 | 376 | False 377 | 0 378 | 379 | 380 | 381 | 382 | Play 383 | True 384 | False 385 | True 386 | True 387 | 388 | 389 | 390 | False 391 | 1 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | True 401 | Individual Information 402 | True 403 | 404 | 405 | 406 | 407 | False 408 | 0 409 | 410 | 411 | 412 | 413 | True 414 | 0 415 | none 416 | 417 | 418 | True 419 | 12 420 | 421 | 422 | True 423 | 3 424 | 2 425 | True 426 | 427 | 428 | True 429 | 0 430 | 0 431 | Max. grade: 432 | 433 | 434 | GTK_FILL 435 | 436 | 437 | 438 | 439 | True 440 | 0 441 | 0 442 | 443 | 444 | 1 445 | 2 446 | GTK_FILL 447 | 448 | 449 | 450 | 451 | True 452 | 0 453 | 0 454 | Min. grade 455 | 456 | 457 | 1 458 | 2 459 | GTK_FILL 460 | 461 | 462 | 463 | 464 | True 465 | 0 466 | 0 467 | 468 | 469 | 1 470 | 2 471 | 1 472 | 2 473 | GTK_FILL 474 | 475 | 476 | 477 | 478 | True 479 | 0 480 | 0 481 | Average grade: 482 | 483 | 484 | 2 485 | 3 486 | GTK_FILL 487 | 488 | 489 | 490 | 491 | True 492 | 0 493 | 494 | 495 | 1 496 | 2 497 | 2 498 | 3 499 | GTK_FILL 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | True 509 | Generation Information 510 | True 511 | 512 | 513 | 514 | 515 | False 516 | False 517 | 1 518 | 519 | 520 | 521 | 522 | False 523 | False 524 | 1 525 | 526 | 527 | 528 | 529 | True 530 | True 531 | 532 | 533 | 534 | 535 | True 536 | 0 537 | none 538 | 539 | 540 | True 541 | 12 542 | 543 | 544 | True 545 | True 546 | automatic 547 | automatic 548 | 549 | 550 | True 551 | True 552 | False 553 | char 554 | False 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | True 564 | Console 565 | True 566 | 567 | 568 | 569 | 570 | True 571 | True 572 | 573 | 574 | 575 | 576 | 1 577 | 578 | 579 | 580 | 581 | 582 | 583 | 5 584 | New neural network 585 | True 586 | normal 587 | 588 | 589 | 590 | True 591 | vertical 592 | 2 593 | 594 | 595 | True 596 | 2 597 | 2 598 | 599 | 600 | True 601 | 0 602 | Name: 603 | 604 | 605 | 606 | 607 | True 608 | True 609 | 610 | 611 | 612 | 1 613 | 2 614 | 615 | 616 | 617 | 618 | True 619 | 0 620 | Dataset: 621 | 622 | 623 | 1 624 | 2 625 | 626 | 627 | 628 | 629 | True 630 | 631 | 632 | 1 633 | 2 634 | 1 635 | 2 636 | 637 | 638 | 639 | 640 | False 641 | 1 642 | 643 | 644 | 645 | 646 | True 647 | end 648 | 649 | 650 | OK 651 | True 652 | True 653 | True 654 | 655 | 656 | 657 | False 658 | False 659 | 0 660 | 661 | 662 | 663 | 664 | False 665 | end 666 | 0 667 | 668 | 669 | 670 | 671 | 672 | new_neural_network_ok_button 673 | 674 | 675 | 676 | 5 677 | New evolution 678 | True 679 | center-on-parent 680 | normal 681 | 682 | 683 | 684 | True 685 | vertical 686 | 2 687 | 688 | 689 | True 690 | vertical 691 | 692 | 693 | True 694 | 5 695 | 2 696 | 697 | 698 | True 699 | 0 700 | Name: 701 | 702 | 703 | 704 | 705 | True 706 | True 707 | 708 | 709 | 710 | 1 711 | 2 712 | 713 | 714 | 715 | 716 | True 717 | 0 718 | Population Size: 719 | 720 | 721 | 1 722 | 2 723 | 724 | 725 | 726 | 727 | True 728 | True 729 | 730 | 731 | 732 | 1 733 | 2 734 | 1 735 | 2 736 | 737 | 738 | 739 | 740 | True 741 | 0 742 | 0 743 | Mutator Types: 744 | 745 | 746 | 2 747 | 3 748 | 749 | 750 | 751 | 752 | True 753 | vertical 754 | 755 | 756 | Random 757 | True 758 | True 759 | False 760 | True 761 | True 762 | 763 | 764 | 0 765 | 766 | 767 | 768 | 769 | Swap 770 | True 771 | False 772 | True 773 | False 774 | True 775 | 776 | 777 | 1 778 | 779 | 780 | 781 | 782 | Replace 783 | True 784 | False 785 | True 786 | False 787 | True 788 | 789 | 790 | 2 791 | 792 | 793 | 794 | 795 | Scramble 796 | True 797 | False 798 | True 799 | False 800 | True 801 | 802 | 803 | 3 804 | 805 | 806 | 807 | 808 | Inversion 809 | True 810 | False 811 | True 812 | False 813 | True 814 | 815 | 816 | 4 817 | 818 | 819 | 820 | 821 | 1 822 | 2 823 | 2 824 | 3 825 | 826 | 827 | 828 | 829 | True 830 | 0 831 | 2.2351741291171123e-010 832 | Crossover Types: 833 | 834 | 835 | 3 836 | 4 837 | 838 | 839 | 840 | 841 | True 842 | vertical 843 | 844 | 845 | Random 846 | True 847 | True 848 | False 849 | True 850 | True 851 | 852 | 853 | 0 854 | 855 | 856 | 857 | 858 | One Point 859 | True 860 | False 861 | True 862 | False 863 | True 864 | 865 | 866 | 1 867 | 868 | 869 | 870 | 871 | Two Point 872 | True 873 | False 874 | True 875 | False 876 | True 877 | 878 | 879 | 2 880 | 881 | 882 | 883 | 884 | Uniform 885 | True 886 | False 887 | True 888 | False 889 | True 890 | 891 | 892 | 3 893 | 894 | 895 | 896 | 897 | 1 898 | 2 899 | 3 900 | 4 901 | 902 | 903 | 904 | 905 | True 906 | 0 907 | Evaluator 908 | 909 | 910 | 4 911 | 5 912 | 913 | 914 | 915 | 916 | True 917 | 918 | 919 | True 920 | False 921 | 922 | 923 | 0 924 | 925 | 926 | 927 | 928 | New 929 | True 930 | True 931 | True 932 | 933 | 934 | 935 | False 936 | 1 937 | 938 | 939 | 940 | 941 | 1 942 | 2 943 | 4 944 | 5 945 | 946 | 947 | 948 | 949 | False 950 | 0 951 | 952 | 953 | 954 | 955 | True 956 | 0 957 | right 958 | 959 | 960 | False 961 | 1 962 | 963 | 964 | 965 | 966 | 1 967 | 968 | 969 | 970 | 971 | True 972 | end 973 | 974 | 975 | OK 976 | True 977 | True 978 | True 979 | 980 | 981 | 982 | False 983 | False 984 | 0 985 | 986 | 987 | 988 | 989 | False 990 | end 991 | 0 992 | 993 | 994 | 995 | 996 | 997 | new_evolution_ok_button 998 | 999 | 1000 | 1001 | 5 1002 | Open evolution 1003 | True 1004 | center-on-parent 1005 | normal 1006 | 1007 | 1008 | 1009 | True 1010 | vertical 1011 | 2 1012 | 1013 | 1014 | True 1015 | 0 1016 | 1017 | 1018 | False 1019 | 1 1020 | 1021 | 1022 | 1023 | 1024 | True 1025 | end 1026 | 1027 | 1028 | OK 1029 | True 1030 | True 1031 | True 1032 | 1033 | 1034 | 1035 | False 1036 | False 1037 | 0 1038 | 1039 | 1040 | 1041 | 1042 | False 1043 | end 1044 | 0 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | open_evolution_ok_button 1051 | 1052 | 1053 | 1054 | --------------------------------------------------------------------------------