def main():
	global first_gen
	global nextGenerations_collHapse

	first_gen = []
	nextGenerations_collHapse = []
	
	read_first_pop()
	generation = runGenetic(50)
	bestIndividual = generation.bestIndividual
	

	
	hap_file = open("ACEHAP_Result.txt",'w')
	for hap in bestIndividual:
		for pos in hap:
			hap_file.write(str(pos))
		hap_file.write("\n")

	number = len(bestIndividual[:][:])

	
	hap_file.close()

	genError.clac_genotype_error()
	genError.calc_switch_error()
def main():
    global Genes
    global first_gen

    read_gens()

    read_first_pop()

    genome = G2DList.G2DList(2 * len(Genes), len(Genes[0]))
    genome.setParams(rangemin=0, rangemax=1)

    genome.crossover.set(Crossovers.G2DListCrossoverSingleHPoint)
    genome.mutator.set(Mutators.G2DListMutatorIntegerGaussian)

    genome.evaluator.set(eval_hap)

    # Genetic Algorithm Instance
    ga = GSimpleGA.GSimpleGA(genome)
    ga.selector.set(Selectors.GRouletteWheel)
    ga.nGenerations = 50
    ga.stepCallback.set(evolve_callback)
    # Do the evolution
    ga.evolve()

    # Best individual
    l = ga.bestIndividual()
    hapFile = open("ACEHAP_Result.txt", "w")
    for row in l:
        line = ""
        for char in row:
            line += str(char)
        hapFile.write(line + "\n")
    hapFile.close()

    genError.clac_genotype_error()
    genError.calc_switch_error()