j
Yes it is
p
In pseudocode the algorithm is really simple:
Copy code
p <- generateInitialPopulation
while (end condition is not met):
    select best fit survivors using fitness function
    mate and mutate survivors
    p <- combine offspring and elites into new population
now p has your best population
j
Yes i've looked into it but i need to have my initial population randomized that i am doing now, im doing the game scheduling problem and the Pair<Int,Int> is one single game
p
To generate the random population you can just do:
Copy code
val p = List(n) { rnd.nextInt() to rnd.nextInt() }
// or if you dont like this then:
val p = List(n) { Pair(rnd.nextInt(), rnd.nextInt()) }
j
I see, but the random numbers cannot be linked to the teams anyhow can they?
p
If you want to link each creature to a team just create your own type for storing creatures:
data class Creature(val x: Int, val y: Int, val t: Team)
j
Oh yes, i've had my teams hardcoded. That's bad practise i guess?
Thats why i wanted to play with the randoms and so on