Class RandomPermutationCycle

java.lang.Object
org.uma.jmetal.util.sequencegenerator.impl.RandomPermutationCycle
All Implemented Interfaces:
SequenceGenerator<Integer>

public class RandomPermutationCycle extends Object implements SequenceGenerator<Integer>
A sequence generator that produces random permutations of integers from 0 (inclusive) to the specified size (exclusive). Each time the sequence is exhausted, a new random permutation is generated.

This implementation uses an efficient algorithm to generate random permutations without repetition until all elements have been used, at which point a new random permutation is created.

Example usage:


 // Will generate sequences like: [2,0,1,3,4], [1,3,2,0,4], [4,2,0,1,3], ...
 SequenceGenerator<Integer> generator = new RandomPermutationCycle(5);
 
Author:
Antonio J. Nebro