question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reproducibility of MOOP by setting the seed of random number generators

See original GitHub issue

Hello everyone,

I have a question concerning multi objective optimization using the jMetal Framework. I have used the “NSGAIITSPRunner.java” (from the package org.uma.jmetal.runner.multiobjective and jMetal 5.1) and for adding reproducibility I added the line

JMetalRandom.getInstance().setSeed(10L);

at the beginning of the main-method. So the main-method looks like this:

public static void main(String[] args) throws IOException {
      JMetalRandom.getInstance().setSeed(10L);

      PermutationProblem<PermutationSolution<Integer>> problem;
      Algorithm<List<PermutationSolution<Integer>>> algorithm;
      CrossoverOperator<PermutationSolution<Integer>> crossover;
      MutationOperator<PermutationSolution<Integer>> mutation;
      SelectionOperator<List<PermutationSolution<Integer>>, PermutationSolution<Integer>> selection;

      problem = new MultiobjectiveTSP("/tspInstances/kroA100.tsp", "/tspInstances/kroB100.tsp");
      [...]

Furthermore, I used the data (kroA100.tsp and kroB100.tsp) which was provided with the framework. I then ran the program once and my FUN.tsv started with the line

“93328.0 132453.0”.

After I ran the program another time the FUN.tsv started with the line

“145839.0 101293.0”.

However, I was wondering why this is happening. I thought that if I set the seed to the same value both times the results would be the same, since the random values which are generated during selection/mutation/… are the same (and this worked for me for non-permutation problems like the ZD1). Can you help me clarify my misunderstanding or my error?

Kind regards

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:41 (33 by maintainers)

github_iconTop GitHub Comments

1reaction
matthieu-vergnecommented, Aug 10, 2016

It would be nice to have a general test which checks all the algorithms, and which passes only when reproducibility is confirmed everywhere (and fails by telling which algorithm is not reproducible). I opened a new issue for that.

1reaction
ajnebrocommented, Aug 10, 2016

You are right. Let me check why this happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting the seed for reproducible random numbers
This is a critical aspect of reproducible research. For example, we can reproduce a random generation of 10 values from a normal distribution:...
Read more >
Random Seeds and Reproducibility - Towards Data Science
In pure Python, you use random.seed() to set the seed, and then you may use random.randint() to draw a random integer, for example:....
Read more >
Random Number Generation, Seed Values, and Reproducibility
The method used to generate the random variables for all distributions is inverse transform, but the exact algorithms are proprietary. Seed ...
Read more >
How can I retrieve the current seed of NumPy's random ...
First, to rephrase the conclusion: Original random seeds (set via np.random.seed ) cannot be retrieved after generating numbers, but ...
Read more >
Random Number Generation — LensKit 0.9.0 documentation
Current best practice for reproducible science in machine learning — including, but not limited to, recommender systems — is to use fixed random...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found