Simulated binary crossover (SBX) crossover operator in the Scala Genetic Algorithm Library (GA)

I am working on a very small research team to create / adapt the Scala genetic algorithm library for distributed computing using the Scientific Worklow System, in our case we use the open source OpenMole software ( http://www.openmole.org/ ).

Recently, I am trying to understand and repurpose the SBX crossover operator written in the Metaheuristics JMetal library ( http://jmetal.sourceforge.net/ ) in order to adapt it in the functional version in our Scala library.

I am writing code, but I need our advice or your check about SBX defined in the java library, because the source code ( src in svn ) does not seem to be equal to the original equation written here: http://citeseerx.ist.psu.edu /viewdoc/download?doi=10.1.1.33.7291&rep=rep1&type=pdf on page 30 in Appendix A

Betaquation

First question, I don’t understand the java version of JMetal, why do they use two different beta versions ?!

  • beta1 , which use the first arg min [(y1 - yL), ...] in the equation and
  • beta2 that use the second argument min [..., (yu - y2)])

Beta 1 and 2 are used to calculate the alpha value and two (so here and in jmetal we also have two alpha values ​​alpha1 and 2) ...

The same problem / question, we have in jmetal two calculations for betaq (java code) or in the Deb equation, the result: betaoverlined

Second question, what is the meaning of the symbol betaoverlined used in procedures (2) and (3) in the pseudo-algorithm SBX, and the difference from the simple beta strong>? Especially when we want to calculate the children / descendants of crossover parents, as here:

enter image description here

Edit

  • Fix block no-op if / else

  • The code author in jmetal gives me a link to the source code for the Nsga-II algorithm, and he explains to me that the SBX description from Deb is different from its implementation:

    http://www.iitk.ac.in/kangal/codes.shtml

    I do not understand the difference between the description and implementation in jmetal and the source code, do you have an explanation?

  • Fix if / else return for map

Start transfer to scala

class SBXBoundedCrossover[G <: GAGenome, F <: GAGenomeFactory[G]](rate: Random => Double = _.nextDouble) extends CrossOver [G, F] { def this(rate: Double) = this( _ => rate) def crossOver (genomes : IndexedSeq [G], factory: F) (implicit aprng : Random) = { val g1 = genomes.random val g2 = genomes.random val crossoverRate = rate(aprng) val EPS = 1.0e-14 val numberOfVariables = g1.wrappedValues.size val distributionIndex = 2 val variableToMutate = (0 until g1.wrappedValues.size).map{x => !(aprng.nextDouble < 0.5)} //crossover probability val offspring = { if (aprng.nextDouble < crossoverRate) { (variableToMutate zip (g1.wrappedValues zip g2.wrappedValues)) map { case (b, (g1e, g2e)) => if(b) { if (abs(g1e - g2e) > EPS){ val y1 = min(g1e, g2e) val y2 = max(g2e, g1e) var yL = 0.0 //g1e.getLowerBound var yu = 1.0 //g1e.getUpperBound var rand = aprng.nextDouble // ui var beta1 = 1.0 + (2.0 * (y1 - yL)/(y2 - y1)) var alpha1 = 2.0 - pow(beta1,-(distributionIndex+1.0)) var betaq1 = computebetaQ(alpha1,distributionIndex,rand) //calcul offspring 1 en utilisant betaq1, correspond au β barre var c1 = 0.5 * ((y1 + y2) - betaq1 * (y2 - y1)) // ----------------------------------------------- var beta2 = 1.0 + (2.0 * (yu - y2) / (y2 - y1)) var alpha2 = 2.0 - pow(beta2, -(distributionIndex + 1.0)) var betaq2 = computebetaQ(alpha2,distributionIndex,rand) //calcul offspring2 en utilisant betaq2 var c2 = 0.5 * ((y1 + y2) + betaq2 * (y2 - y1)) if (c1 < yL) c1 = yL if (c1 > yu) c1 = yu if (c2 < yL) c2 = yL if (c2 > yu) c2 = yu if (aprng.nextDouble <= 0.5) { (c2,c1) } else { (c1, c2) } }else{ (g1e, g2e) } }else{ (g2e, g1e) } } }else{ // not so good here ... (g1.wrappedValues zip g2.wrappedValues) } } (factory.buildGenome(offspring.map{_._1}), factory.buildGenome(offspring.map{_._2})) } def computebetaQ(alpha:Double, distributionIndex:Double, rand:Double):Double = { if (rand <= (1.0/alpha)){ pow ((rand * alpha),(1.0 / (distributionIndex + 1.0))) } else { pow ((1.0 / (2.0 - rand * alpha)),(1.0 / (distributionIndex + 1.0))) } } 

Thanks so much for your advice or help with this issue.

SR

+4
source share
2 answers

Reyman64, your question is the answer I was looking for. Thanks.

I took the paper you linked and the Deb implementation code and tried to figure them out. For this, I commented on almost every line of code. They differ only in beta calculation.

Since Deb used this code in his NSGA-II implementation, I will stick with this version of the algorithm.

If someone is in the same situation, I was (not understanding how to implement SBX), I left my comments in the following form, take a look.

https://gist.github.com/Tiagoperes/1779d5f1c89bae0cfdb87b1960bba36d

+1
source

I have implemented an SBX implementation (it is called Simulated Binary Crossover btw) for HeuristicLab (C #). You can take a look at the implementation of our SimulatedBinaryCrossover . However, I took the description from another link (document title: “Simulated Binary Crossover for Continuous Search Space” since 1995). The full citation is given in the source code.

+2
source

Source: https://habr.com/ru/post/1391721/


All Articles