private ArrayList<Individuum> initialPopulation(int popsize){
  ArrayList<Individuum> population=new ArrayList<>(popsize);
  for (int i=0; i < popsize; i++) {
    short[] gene=new short[dim];
    Arrays.fill(gene,DONT_CARE);
    int countDim=k;
    while (countDim > 0) {
      int z=random.nextInt(dim);
      if (gene[z] != DONT_CARE) {
        continue;
      }
      gene[z]=(short)(random.nextInt(phi) + GENE_OFFSET);
      countDim--;
    }
    population.add(makeIndividuum(gene));
  }
  return population;
}

private ArrayList < Individuum > initialPopulation ( int popsize ) { ArrayList < Individuum > population = new ArrayList < > ( popsize ) ; for ( int i = 0 ; i < popsize ; i ++ ) { short [ ] gene = new short [ dim ] ; Arrays . fill ( gene , DONT_CARE ) ; int countDim = k ; while ( countDim > 0 ) { int z = random . nextInt ( dim ) ; if ( gene [ z ] != DONT_CARE ) { continue ; } gene [ z ] = ( short ) ( random . nextInt ( phi ) + GENE_OFFSET ) ; countDim -- ; } population . add ( makeIndividuum ( gene ) ) ; } return population ; }
produce an initial ( random ) population .
