matlab,initialization,genetic-algorithm,population

Why not use an encoding x[1,2,1,2] instead of x[1,0;0,1;1,0;0,1]? And then use randi([1,2],[4,1]) for initialization. Your encoding is kind of redundant, or did I get the question wrong? Alternatively you could do: r = randi([1,2],[4,1]); x = zeros(4,2); for idx = 1:size(r,1); if r(idx) == 1 x(idx,1) = 1; else...

Overfitting in genetic algorithms and programming is a big issue which is currently under research focus of the GP community, including myself. Most of the research is aimed at genetic programming and evolution of classification/regression models but it might also relate to your problem. There are some papers which might...

It looks like you want to store the binary representation of your numbers, so you can use the function dec2bin and the best thing, you don't even need a loop ;) r=randi([0 3],1,20); x = dec2bin(r,2) ; >> x x = 10 00 11 11 10 11 10 01 ......

python,artificial-intelligence,genetic-algorithm

First and foremost, I am obligated to say that Tic Tac Toe is really too simple a problem to reasonably attack with a genetic program. You simply don't need the power of a GP to win Tic Tac Toe; you can solve it with a brute force lookup table, or...

c++,random,genetic-algorithm,number-theory

For crypto, you need very strong properties on your random numbers. Much of the literature out there focusses on these sorts of requirements. A typical solution would be seeding iterated applications of SHA-256 using environmental noise (hard drive delays, network packets, mouse movements, RDRAND, HAVEGE, ...). For Monte-Carlo simulations or...

java,collections,genetic-algorithm

I thinks your algorithm has early convergence, if other things are OK. possible solutions are: 1- set Elitism Rate to zero; 2- reduce crossover rate; 3- increase mutation rate. also if the problem being solved is very simple, GA early convergence is natural. ...

neural-network,genetic-algorithm,encog,simulated-annealing,particle-swarm

It seems logical, however it will not work. With the default parameters of the RPROP, this sequence will not likely work. The reason why is that after your previous training the weights of the neural network will be near a local optimum. Because of the nearness to a local optimum...

c++,c++11,genetic-algorithm,evolutionary-algorithm,crossover

random_int For debugging purpose (repeatability) you shouldn't always call rd(). Moreover you are recreating the pseudo-RNG at every call. Call the random device just once and do everything else with a (randomly) seeded pseudo-RNG. As a bonus, you should store the seed value in a log file so you...

genetic-algorithm,mql,algorithmic-trading,metatrader5,mql5

It is not possible to alter the optimization engine in MT5 as far as I am aware. If you are not totally restricted to MT5, I can recommend joining Asirikuy, who collaboratively develop their own trading software, which would allow you to customize the engine. There may be other groups...

This is a form of crowding. For example, NSGA-II (a multi-objective GA) uses a crowding mechanism more or less identical to the one you described. But it's a form of elitism too....

python,max,average,min,genetic-algorithm

You have this error because you're calling the method without passing any list (a population in this case).

python,algorithm,artificial-intelligence,genetic-algorithm

I answered my a similar question on the computer science stackexchange here which explains in the best way possible how to find out which is a good selection method for your problem. However it doesn't look as thought you have implemented mutation which is responsible for maintaining diversity in the...

machine-learning,neural-network,genetic-algorithm,evolutionary-algorithm

You can include as many hidden layers you want, starting from zero (--that case is called perceptron). The ability to represent unknown functions, however, does -- in principle -- not increase. Single-hidden layer neural networks already possess a universal representation property: by increasing the number of hidden neurons, they can...

Refer here for the documentation. A = cat(1,ones(1,nvars), ones(1,nvars)*-1)/W/H; b = [0.4;-0.2]; function [ceq ce] = noncolon1(x) ce = []; ceq = x(1,2:end) - x(1,1:end-1); end [x , fval] = ga(@fitnessfunc,nvars,A,b,[],[],[],[],@noncolon1); ...

data,genetic-algorithm,evolutionary-algorithm

When you gauge the performance of a Genetic Algorithm (or any other stochastic algorithm), you run it multiple times and then aggregate the results to eliminate the effect of some runs being "lucky" or "unlucky". Then it's about presenting such aggregated results. For a single run (among many of those),...

algorithm,artificial-intelligence,genetic-algorithm,arithmetic-expressions

Long processing time is most probably because of small probability of an event that two chromosomes have different types (operator or digit) of characters on the same position. Note that for 1 digit numbers two chromosomes will always have the same type on the same position. The solution is to...

javascript,genetic-algorithm,paperjs

It looks like you are always setting child_gene.visible = false, but never set it back to visible = true before you rasterize the layer in computeFitness(). I'm not sure that there's a need for juggling layers in each frame - it should work just as well without it. Here's a...

python,python-2.7,pygame,genetic-algorithm

I suspect the livingCreatures variable is never set to False, so the pygame.display.flip() never gets called--and you won't see anything on the screen at all until you flip the buffers. The fact that you're filling the screen with a color, but then still seeing black, is a dead giveaway for...

java,algorithm,neural-network,genetic-algorithm,encog

Not all trainers in Encog support the simple pause/resume. If they do not support it, they return null, like this one. The genetic algorithm trainer is much more complex than a simple propagation trainer that supports pause/resume. To save the state of the genetic algorithm, you must save the entire...

optimization,genetic-algorithm,path-finding

Genetic Algorithm as it is cannot be easily used for multi-objective optimisation directly. If you want to use the purest GA you have to combine the objectives into a single objective, e.g. by summing weighted values of each objective. But this often does not work very well, especially when there...

python,python-3.x,numpy,genetic-algorithm,itertools

Your loop isn't executing because i and j are both 0, so range(i) and range(j) are empty. Also you can't assign a list [i,random] to an array value (np.empty defaults to np.float64). I've simply changed it to only store the random number, but if you really want to store a...

machine-learning,artificial-intelligence,genetic-algorithm

I do not really know why you are performing GA like that, could you give some references? In any case here goes my typical solution for implementing a functional GA method: Run the the 100 genes in the fitness function and get the result. Randomly choose 2 genes based on...

arrays,multidimensional-array,genetic-algorithm

There is no standard way to do crossover. For what I know there are no definitive results on the convergency rate of one type of crossover w.r.t. to another or also w.r.t. no crossover (sometimes it is not used at all and in these cases evolution is only based on...

I'm not 100% sure what you are doing and this answer assumes you are storing a as a 64-bit value (long) currently. The following code may help point you in the right direction. const double minValue = -5.12; const double maxValue = 5.12; var initialValue = Convert.ToInt64("100000000000000011000100100110111010010111100011010100111111100", 2); var changedValue...

A lot of these decisions are made after experimentation with one's particular software and domain. Of course two parents can generate more than two children. This may happen either because: crossover operator creates more than two children; tournament selection picks repeatedly the same parents (with a simple steady state population...

There are several strategies to keep population size at a fixed value. For example, you can first add the offspring to the whole population, evaluate the new individuals, then sort the population by fitness value and keep killing the worst individuals until you reach the desired size. This approach is...

This is because python integer is meant to truncate down to the lowest value. You have a bunch of options to get around this: >>> 5 / 2 2 Option 1 Cast one of your values as float and python will automatically up-cast all other int types >>> 5 /...

Simply sort the chromosomes before storing them. Since different permutations of the same set of integers will sort out into the same sequence, you can use the code you are already using to remove the duplicates.

statistics,genetic-algorithm,prediction,generalization

The problem with over-fitting is that, within a single data-set it's pretty challenging to tell over-fitting apart from actually getting better in the general case. In many ways, this is more of an art than a science, but here are some general guidelines: A GA will learn to do exactly...

c++,machine-learning,neural-network,genetic-algorithm

Here is the best answer I can give, based on my interpretation of your question. Apologize if it is not what you were asking for, but you did ask for the most basic explanation. I don't see exactly how the tank track values relate to the ability of the tank...

java,artificial-intelligence,genetic-algorithm

Mutate is spelled without the double tt. Your code will never mutate the last position because of the way you call random. The problem is substring(start, end) returns a string that does not include the end index character. So you're losing one character. The whole if block is unneeded as...

c++,optimization,genetic-algorithm,recompile,hill-climbing

I guess your current program looks something like this int main() { #define x 5 <do the simulation> cout << "x=" << x << " time=" << aat << endl; Instead you might create a simulate function that takes x as an explicit parameter and returns the average access time...

optimization,fortran,fortran90,genetic-algorithm

cubic is supposed to return the gradient and thus must be a vector. Try the following: module functions implicit none contains function cubic(x,n) result(g) integer, intent(in) :: n real*8, dimension(n), intent(in) :: x real*8, dimension(n) :: g g =(/ 4.d0*(x(1)**3.d0), 8.d0*(x(2)**3.d0) /) end function cubic end module program SOGradient use...

If you are evolving the network structure and weights, there is an excellent algorithm called NEAT. If you are evolving the weights only, you have several possibilites, but the most basic one is use the weight matrix of the network graph as a genotype. Then, crossover can be done using...

selection,genetic-algorithm,parents

Generally for a GA, you choose your mating algorithm such that the population size remains fixed. So for you example with a population size of 500, you'll choose 250 pairs of fit individuals to mate and have 2 offspring per pair, or choose 500 pairs and have 1 offspring. In...

The best choice here is to use sortBy from Data.List: sortBy :: (a -> a -> Ordering) -> [a] -> [a] The sortBy function is higher order, so it takes a function as one of its arguments. The function it needs is one that takes two elements and returns a...

java,binary,genetic-algorithm,evolutionary-algorithm

Using machine internal representation is considered harmful because it leads to deceptive solutions in genetic algorithms. There are many articles about MDP (Minimal Deceptive Problem) in genetic algoritms that cover this topic, for example: http://www.dtic.mil/get-tr-doc/pdf?AD=ADA294072 and great David Goldberg's book which explains deceptive problems and MDP and Building Blocks hypothesis...

performance,matlab,genetic-algorithm

Could not figure out to improve feval. So decided to bypass it altogether. Set options.Vectorized='on' and modified the fitness function to take array of inputs....

In general, optimization solving algorithms converge to a local minimum. To get out of this local minimum in a Genetic Algorithm, you can use mutations. Mutations are applied to some individuals of a generation. Usually, mutations will be bad and make the result worse and they will not be selected...

java,algorithm,genetic-algorithm

Let's have a closer look at the snippet of your static getFitness(Chromosome chrom) function: for(int x = 0; x< solution.length;x++){ return fitness += Math.abs((int)(chrom.getGene(x)) - (int)(solution[x])); } return fitness; Are you trying to accumulate fitness here? If so, it does not work, as you are returning fitness right after you...

algorithm,genetic-algorithm,evolutionary-algorithm

Elitism means taking explicit measures to preserve good individuals from the current generation to the next. As a result, degradation will not happen. Your first algorithm guarantees that the best 50% individuals of the current population are preserved to the next generation. The second algorithm guarantees nothing. As a result,...

When doing ranked selection, is each individual only allowed to be selected once? Well, if every individual was allowed to be selected only once, you would have to copy the whole population to form the new one. In ranked selection you just pick probabilistically with probability proportional to the...

algorithm,artificial-intelligence,mathematical-optimization,genetic-algorithm

Since memory is hardly a problem nowadays, I'd choose a representation which is easy to work with from a programmers point of view (readability) supports your algorithm Using bit arrays will save space, but you'll end up with a lot of macros or function calls to separate the information over...

vb.net,branch,genetic-algorithm

I don't know VB, but the following should be general enough. If the genotypes are directly the city permutations the data structures I use are (for N cities): a distance matrix - a N-1 by N-1 2-D array where position (i, j) contains the distance from i-th city to j-th...

lua,genetic-algorithm,genetic-programming

Here is my quick implementation of k-point crossover for integers using mostly integer arithmetic. Starting with this, you can extend it to crossover your chromosomes of many pairs of integers using a loop. math.randomseed(111) -- math.randomseed(os.time()) a = 12345 b = 67890 len = 5 -- number of digits function...

selection,genetic-algorithm,genetic-programming,roulette-wheel-selection

Roulette wheel selection (aka Fitness proportionate selection) The fitness is used to associate a probability of selection to each individual. If fi is the fitness of individual i in the population, its probability of being selected is: pi = fi / Σ j(fj) for j = 1 … N (N...

algorithm,max,mathematical-optimization,genetic-algorithm,evolutionary-algorithm

So let's say for some function f(x,y,z), I want to find what would give the highest value that would be maximization, right? And if I wanted to find the lowest value that would be minimization? Yes, that's by definition true. So if a genetic algorithm is a search algorithm...

algorithm,genetic-algorithm,genetic-programming,mutation

Essentially it's how far a mutation can be away from the last value. "As far as real-valued search spaces are concerned, mutation is normally performed by adding a normally distributed random value to each vector component. The step size or mutation strength (i.e. the standard deviation of the normal distribution)...

java,swing,algorithm,genetic-algorithm

As i said i tried to separate the logic from the paint. My solution is very bad but can give some feelings. My idea is: Share the variables that you will use to draw between the Logic method and the Draw method. So you can call the repaint method whenever...

math,mathematical-optimization,genetic-algorithm

≺ is called precedes, ≻ succeeds. According to the well known Evolutionary Optimization Algorithms the standard notation for A dominates B is A ≻ B: 20.1 Pareto Optimality [...] Domination: a point x* is said to dominate x if the following two conditions hold: fi(x*) <= fi(x) for all i...

c++,neural-network,genetic-algorithm,temporary-objects

First consider this subset of the CNeuralNetwork class: class CNeuralNetwork { // ... public: std::vector<CSynapticConnection *> getm_vListofSynaptics() { return m_vListofSynaptics; } std::vector<CSynapticConnection*> m_vListofSynaptics; // ... }; Here you have a getter (getm_vListofSynaptics()) that returns a temporary value: a copy of the public data member m_vListofSynaptics. In the CGeneticEngine::NewPopulation() function you're...

machine-learning,genetic-algorithm,evolutionary-algorithm,genetic-programming

Well, that's tricky. Genetic programming (the original Koza-style GP) is best suited for functional-style programming, i.e. there is no internal execution state and every node is a function that returns (and maybe takes) values, like lisp. That is a problem when the node is some loop - it is not...

matrix,mathematical-optimization,genetic-algorithm

Any structure of fixed size and shape that is made of numbers (or any other elements) can be rewritten to a 1-D vector and back. You can then use any operator you like which works on vectors. If you wanted to work with matrices (or any other structures) directly you...

python,algorithm,mathematical-optimization,genetic-algorithm

A solution x is pareto dominated if there exists a solution y where y is no worse than x in any dimension and is strictly better in some dimension. I'll assume you're trying to minimize in all dimensions for your problem. Then you can take the following approach (the code...

You could draw some inspiration from the fibonacci sequence. Vi Hart has a really nice video on this topic (3 video series): http://www.youtube.com/watch?v=ahXIMUkSXX0...