This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Node: | |
def __init__(self,key): | |
self.left = None | |
self.right = None | |
self.val = key | |
def insert(self, node): | |
if self.val < node.val: | |
if self.right is None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import random | |
import math | |
def nextGeneration(population): | |
print('next generation') | |
size = len(population) | |
calculateFitness() | |
for i in range(size): | |
population[i] = pickOne(population) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import random | |
def round(x): | |
large = int(x+1) | |
if large-x <= .5: | |
return large | |
else: | |
return int(x) |
NewerOlder