genetic-algorithm

Unable to speed up Python DEAP with Multiprocessing

别等时光非礼了梦想. 提交于 2020-06-16 16:59:11
问题 I am using the below sample code for OneMax problem (maximizing the number of ones of a bitstring) using DEAP package and multiprocessing. I am unable to speed up the process using multiprocessing. I want to use this for a more complex problem before finding out what is the issue here. Thank you. import array import multiprocessing from multiprocessing import Pool import random import time import numpy as np from deap import algorithms from deap import base from deap import creator from deap

Why isn't my pygame display displaying anything?

て烟熏妆下的殇ゞ 提交于 2020-01-17 02:51:05
问题 I am working on a program that evolves creatures over time using a genetic algorithm. However, for some reason, my pygame display stopped working and I have absolutely no idea why. When I run the program, the window opens but then it just sits on a black screen. I have tested to see where the program gets to and about 38 creatures die then nothing happens. However, these creatures should be displaying before their deaths also, but they aren't.Any help would be wonderful! Thank you for all

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?

Best Data Structure for Genetic Algorithm in C++?

老子叫甜甜 提交于 2020-01-14 14:25:29
问题 i need to implement a genetic algorithm customized for my problem (college project), and the first version had it coded as an matrix of short ( bits per chromosome x size of population). That was a bad design, since i am declaring a short but only using the "0" and "1" values... but it was just a prototype and it worked as intended, and now it is time for me to develop a new, improved version. Performance is important here, but simplicity is also appreciated. I researched around and came up

MATLAB genetic algorithm optimization returns integer values higher than boundaries and violates inequality constraints. Why?

天大地大妈咪最大 提交于 2020-01-14 06:13:27
问题 I'm using MATLAB R2016a genetic algorithm optimization toolbox to optimize 80 integer values. I have these constraints: x(80) > x(79) > x(78) > x(77) > x(76) ... x(5) > x(4) > x(3) > x(2) > x(1) The range for all integer variables is between 1 and 500. I used this code in MATLAB: f = @(x)Cost_function(x, my_data); num_of_var = 80; for mx = 1:num_of_var-1 A(mx,:) = [zeros(1,mx-1),1,-1, zeros(1,num_of_var-mx-1)]; end b = repmat(-3, [num_of_var-1,1]); lb = ones([num_of_var-1,1]); up = repmat(500

glmulti runs indefinitely when using genetic algorithm with lme4

谁都会走 提交于 2020-01-12 05:12:11
问题 I'm using glmulti for model averaging in R. There are ~10 variables in my model, making exhaustive screening impractical - I therefore need to use the genetic algorithm (GA) (call: method = "g"). I need to include random effects so I'm using glmulti as a wrapper for lme4. Methods for doing this are available here http://www.inside-r.org/packages/cran/glmulti/docs/glmulti and there is also a pdf included with the glmulti package that goes into more detail. The problem is that when telling

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

Using nested for loops in Fitness Function in Genetic Algroithims makes it too slow

為{幸葍}努か 提交于 2020-01-06 12:23:13
问题 Im trying to use Genetic Algorithims using "GA" Package but faced a problem in making the fitness function, im using GA to simulate my data and get the most fitted values for constants in my model. My data is from observations for a car speed and other parameters, so let's say i've a car and it made a 2 trips, and i want to make a model for it. Each trip have multiple columns ( speed, delta velocity with the opposite car, and Range between the two cars ), so i've to take the first row of each

Using nested for loops in Fitness Function in Genetic Algroithims makes it too slow

旧城冷巷雨未停 提交于 2020-01-06 12:23:07
问题 Im trying to use Genetic Algorithims using "GA" Package but faced a problem in making the fitness function, im using GA to simulate my data and get the most fitted values for constants in my model. My data is from observations for a car speed and other parameters, so let's say i've a car and it made a 2 trips, and i want to make a model for it. Each trip have multiple columns ( speed, delta velocity with the opposite car, and Range between the two cars ), so i've to take the first row of each

Python DEAP library, using random words as individuals

守給你的承諾、 提交于 2020-01-06 05:28:15
问题 I'm trying to get a better handle on DEAP. I want to make a genetic algorithm that has words as individuals as a population and it maximizes this by checking how far in distance(read: spelling) these words are from a given "maximal word". This is what I have done so far following examples in the documentation import random from randomwordgenerator import randomwordgenerator from deap import base from deap import creator from deap import tools creator.create("FitnessMax", base.Fitness, weights