fvwm3 has traditionally been using autotools. However, this is now deprecated in favour of meson. It is suggested that all systems which support meson use this instead as it is now the preferred build system to use.
pythonにて遺伝的アルゴリズムを試してみる。
DEAP is a novel evolutionary computation framework
%%time
import random
import numpy
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
creator.create("Individual",list, fitness=creator.FitnessMax)
toolbox = base.Toolbox()
toolbox.register("attr_bool", random.randint,0,1)
toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attr_bool,200)
toolbox.register("population", tools.initRepeat,list, toolbox.individual)defevalOneMax(individual):
total=individual.count(1)###1の個数を数えるreturn(total),
toolbox.register("evaluate", evalOneMax)
toolbox.register("mate", tools.cxTwoPoint)
toolbox.register("mutate", tools.mutFlipBit, indpb=0.03)
toolbox.register("select", tools.selTournament, tournsize=3)defmain():
random.seed(64)##random Fix
pop = toolbox.population(n=300)
hof = tools.HallOfFame(1)
stats = tools.Statistics(lambda ind: ind.fitness.values)#stats.register("avg", numpy.mean)#stats.register("std", numpy.std)
stats.register("min", numpy.min)
stats.register("max", numpy.max)
algorithms.eaSimple(pop, toolbox,0.5,0.2,50, stats, halloffame=hof)return pop
if __name__ =="__main__":
pop=main()
best_ind = tools.selBest(pop,1)[0]print("Best individual is %s, %s"%(best_ind, best_ind.fitness.values))
gen nevals minmax030078120118789122215796127317699129...4917817418950187172189
Best individual is[1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1],(189.0,)
CPU times: user 1.09 s, sys:688 µs, total:1.09 s
Wall time:1.09 s