genetic-programming

Using multiprocessing in DEAP for genetic programming

浪尽此生 提交于 2020-08-09 10:19:07
问题 I'm using DEAP library to implement genetic programming and I have used eaMuCommaLambda algorithm for this purpose. In order to run the program in parallel, I followed the instructions in the DEAP document and added the two following lines of code in the if __name__ == "__main__" section. import multiprocessing pool = multiprocessing.Pool() toolbox.register("map", pool.map) pop, log = algorithms.eaMuCommaLambda(pop, toolbox, MU, LAMBDA, cxpb, mutpb, gen, halloffame=hof, stats=mstats, verbose

Using multiprocessing in DEAP for genetic programming

醉酒当歌 提交于 2020-08-09 10:18:50
问题 I'm using DEAP library to implement genetic programming and I have used eaMuCommaLambda algorithm for this purpose. In order to run the program in parallel, I followed the instructions in the DEAP document and added the two following lines of code in the if __name__ == "__main__" section. import multiprocessing pool = multiprocessing.Pool() toolbox.register("map", pool.map) pop, log = algorithms.eaMuCommaLambda(pop, toolbox, MU, LAMBDA, cxpb, mutpb, gen, halloffame=hof, stats=mstats, verbose

How to get the parameters' type and return type of a function?

妖精的绣舞 提交于 2020-07-18 15:56:49
问题 I'm trying to implement strong type genetic programming in python. Is there something like these sample? def funcA(a,b): return a + b return_type(funcA) output: <class 'Integer'> and def funcA(a,b): return a + b parameter_type(funcA) output: [<class 'Integer'>,<class 'Integer'>] update: I'm trying to generate python's expression and avoiding something cannot be evaluated like this: funcA(20, funcA(True, "text")) 回答1: Python 3 introduces function annotations. By themselves they don't do

Can i have a variable length chromosome in JGAP?

回眸只為那壹抹淺笑 提交于 2020-01-15 07:51:47
问题 Im using JGAP to generate testvectors for a schematic. I got maximum coverage of a single testvector by setting the genes of a chromosome to be bits . Now i need to get a 100% coverage with minimum number of testvectors. If i design each gene to be a testvector, id need to calculate a fitness function based on the number of genes and total coverage and id also need to evolve both chromosome length and each testvectors(genes) bits .. is it even possible to have a variable length chromosome?

What are the differences between genetic algorithms and genetic programming?

假装没事ソ 提交于 2020-01-09 06:46:11
问题 I would like to have a simple explanation of the differences between genetic algorithms and genetic programming (without too much programming jargon). Examples would also be appreciated. Apparently, in genetic programming, solutions are computer programs. On the other hand, genetic algorithms represent a solution as a string of numbers. Any other differences? 回答1: Genetic programming and genetic algorithms are very similar. They are both used to evolve the answer to a problem, by comparing

How to remove overlap in numeric ranges (AWK)

老子叫甜甜 提交于 2020-01-02 14:56:33
问题 I'm trying to remove the overlap within a file. There's a bunch of records that starts with an 'A' and which have a 'start-value' and an 'end-value'. There's also a bunch of records that start with a 'B', also has range and that shows a possible overlap with records starting with 'A'. The idea is to remove the overlapping range from A so only non-overlapping ranges exist. Some of the records in B have an identical 'start-value' while others have an identical 'end-value' with A. So, if A has a

AI How to model genetic programming for Battleships

你离开我真会死。 提交于 2019-12-30 03:34:10
问题 I have a question regarding Genetic Programming. I am going to work on a genetic algorithm for a game called Battleships. My question is: How would I decide upon a "decision" model for the AI to evolve? And how does that work? I have read multiple papers and multiple answers that just speak about using different models, but could not find something specific, which, unfortunately, I apparently need to wrap my head around the problem. I want it to evolve over multiple iterations and "learn"

Genetic Programming in Haskell

[亡魂溺海] 提交于 2019-12-21 05:18:16
问题 There is GenProg (http://hackage.haskell.org/package/genprog) for example, but that only deals with numerical optimization, in this case finding an equation that describes the data. But I require for loops, if statements, when statements, Boolean checks etc. I need to be able to generate imperative structures. Any thought on this? My best options so far seem to be husk-scheme where I can run Scheme code as a DSL in Haskell. Surely there must be better ways? 回答1: If you're looking for

Choosing parents to crossover in genetic algorithms?

大兔子大兔子 提交于 2019-12-12 19:12:10
问题 First of all, this is a part of a homework. I am trying to implement a genetic algorithm. I am confused about selecting parents to crossover. In my notes (obviously something is wrong) this is what is done as example; Pc (possibility of crossover) * population size = estimated chromosome count to crossover (if not even, round to one of closest even) Choose a random number in range [0,1] for every chromosome and if this number is smaller then Pc, choose this chromosome for a crossover pair.

counting sets of numbers in a long list

☆樱花仙子☆ 提交于 2019-12-12 17:08:31
问题 As I am new to python programming, I am having difficulty writing a python program. I am trying to count a set of seven objects(?) of three numbered digits and tabs within a long list. Then I need to find which set of numbers (in multiples of three's) have the maximum number along the list. The numbers are separated by a tab and the set of numbers are in seven's. For example: ['128','130','140','145','','','','283','379','','','','','','175','183','187','','','',''etc.] The first set of