1

I would like to ask is it possible to run the GA with different seed to generate the initial solution and make analysis ?. However, at the beginning of applying GA, you have to produce number of population solutions. For example, You run the genetic algorithm using seed "12345" to generate initial solution , and then you populate list of random solutions from this initial solution, and continue applying GA steps to solve the problem.

Then you run the genetic with another seed for example "5678" to generate initial solution , and then you populate list of random solutions from this initial solution, and continue applying GA steps to solve the problem..

That means the populated list in first run may contain the initial solution that has been generated in the second run.

My question is , Is there any way I can use GA with different seed to make comparison and analysis ?, If not, how can I compare and make analysis , should I only use different instance file for the problem ?

Yasmin
  • 931
  • 3
  • 14
  • 35
  • what do you mean by different seed? it's useless to change it during the algorithm, you set it once. and it doesn't matter if it is GA or whatever. – sashkello May 20 '13 at 11:49
  • I would like to use different seed with the initial solution – Yasmin May 20 '13 at 11:51
  • Why do you want it? What's the purpose? – sashkello May 20 '13 at 11:53
  • Because I have already tested other algorithms of solving TSP with different seeds and I would like to make comparison. So I am asking if that applicable in GA, How can I do it? Is it generally not applicable in Evolutionary algorithms ? – Yasmin May 20 '13 at 11:57
  • Sorry, but I don't get it. Seed is used to generate a series of random numbers. There is no relation to what algorithm you use it for. – sashkello May 20 '13 at 12:01
  • I edited the question with an example – Yasmin May 20 '13 at 12:09
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/30255/discussion-between-jesy-and-sashkello) – Yasmin May 20 '13 at 12:17
  • I don't understand the question at all, but maybe this helps - just set your random generator to a specific seed at the start of each run. So the sequence of random numbers generated are different, so the initial solutions have a high probability of being different at each run and the mutation and cross-over, where there's randomness, will also be different. So you'd likely end up with another local-minimum, if there are a few. Well, you don't have to **explicitly** set the seed, since, after generating a few number to populate the initial population, the seed **will** be different. – Bernhard Barker May 20 '13 at 13:15
  • Also probably Cross-Validated is a better fit for this question: http://stats.stackexchange.com/ – sashkello May 20 '13 at 13:16
  • "Comparison" and "analysis" of what? The generated solutions? How does that have anything to do with random numbers? And what's an "instance file"? – Bernhard Barker May 20 '13 at 13:24
  • instance file for TSPTW problem http://iridia.ulb.ac.be/~manuel/tsptw-instances , I did implement tabu , VND and Iterative improvement, and I used different seeds and compare all others together against best solution to know which algorithm is better than the other,but in GA case, I won't be able to compare it if it has different random generated even I started with my ransom initial solution using specific seed – Yasmin May 20 '13 at 13:37
  • @Dukeling : If I run the GA algorithm multiple times with the same seed for initial solution, the result will be completely different. – Yasmin May 20 '13 at 13:42
  • So you run the GA for some given instance? Is that what you mean by "seed", as in the one of those that you picked? If so, mostly ignore my first comment. Also, I'm still not sure why you aren't able to compare it. At the end of the GA run, you have a 'best' solution, just compare that to whatever. – Bernhard Barker May 20 '13 at 14:07

1 Answers1

1

To make comparisons of stochastic algorithms first you typically run them multiple times with different random seeds. The output you then obtain is a random variable. You can then assess whether one algorithm is better than another by performing a statistical hypothesis test (ANOVA or Kruskal-Wallis for multiple comparisons, t-test or Mann-Whitney U test for pairwise comparisons) on the resulting samples. If the obtained p-value in these tests is below your desired threshold (typically 0.05, but for more rigorous proofs you would set this lower e.g. 0.01) you would reject the H0 hypothesis that these results are equal e.g. with respect to their means. Thus you assume that the results are unequal and further, that the one with the better average performance is the better algorithm to choose (if you're interested in average performance - "better" usually has many dimensions).

One thing made me wonder in your comments:

If I run the GA algorithm multiple times with the same seed for initial solution, the result will be completely different

I think you have made some error in your code. You need to use the same random object throughout any random decision made inside your algorithm in order to obtain exactly the same result. Somewhere in your code you probably use a new Random() instead of the one that you obtained initially with the given seed. Another reason could be that you use parallel processing of parts that draw random numbers. You can never guarantee that your threads are always executed in the same order, so one time thread 1 gets the first random number and thread 2 the second one, another time thread 2 executes first and gets the first number.

Andreas
  • 6,447
  • 2
  • 34
  • 46
  • Thanks so much, I got it, I wrote this statements because I didn't use the random seed once in my program, but now I am using it once and it works, I really appreciate your help – Yasmin May 20 '13 at 22:33