public static void evolve_symmetric(RealVariable v1,RealVariable v2,double distributionIndex,boolean swap){
  double y1, y2, betaq, beta, alpha, rand;
  double x1=v1.getValue();
  double x2=v2.getValue();
  double lb=v1.getLowerBound();
  double ub=v1.getUpperBound();
  if (Math.abs(x1 - x2) > Settings.EPS) {
    if (x2 > x1) {
      y2=x2;
      y1=x1;
    }
 else {
      y2=x1;
      y1=x2;
    }
    if ((y1 - lb) > (ub - y2)) {
      beta=1 + (2 * (ub - y2) / (y2 - y1));
    }
 else {
      beta=1 + (2 * (y1 - lb) / (y2 - y1));
    }
    beta=1.0 / beta;
    alpha=2.0 - Math.pow(beta,distributionIndex + 1.0);
    rand=PRNG.nextDouble();
    if (rand <= 1.0 / alpha) {
      alpha=alpha * rand;
      betaq=Math.pow(alpha,1.0 / (distributionIndex + 1.0));
    }
 else {
      alpha=alpha * rand;
      alpha=1.0 / (2.0 - alpha);
      betaq=Math.pow(alpha,1.0 / (distributionIndex + 1.0));
    }
    x1=0.5 * ((y1 + y2) - betaq * (y2 - y1));
    x2=0.5 * ((y1 + y2) + betaq * (y2 - y1));
    if (x1 < lb) {
      x1=lb;
    }
 else     if (x1 > ub) {
      x1=ub;
    }
    if (x2 < lb) {
      x2=lb;
    }
 else     if (x2 > ub) {
      x2=ub;
    }
    if (swap && PRNG.nextBoolean()) {
      double temp=x1;
      x1=x2;
      x2=temp;
    }
    v1.setValue(x1);
    v2.setValue(x2);
  }
}

public static void evolve_symmetric ( RealVariable v1 , RealVariable v2 , double distributionIndex , boolean swap ) { double y1 , y2 , betaq , beta , alpha , rand ; double x1 = v1 . getValue ( ) ; double x2 = v2 . getValue ( ) ; double lb = v1 . getLowerBound ( ) ; double ub = v1 . getUpperBound ( ) ; if ( Math . abs ( x1 - x2 ) > Settings . EPS ) { if ( x2 > x1 ) { y2 = x2 ; y1 = x1 ; } else { y2 = x1 ; y1 = x2 ; } if ( ( y1 - lb ) > ( ub - y2 ) ) { beta = 1 + ( 2 * ( ub - y2 ) / ( y2 - y1 ) ) ; } else { beta = 1 + ( 2 * ( y1 - lb ) / ( y2 - y1 ) ) ; } beta = 1.0 / beta ; alpha = 2.0 - Math . pow ( beta , distributionIndex + 1.0 ) ; rand = PRNG . nextDouble ( ) ; if ( rand <= 1.0 / alpha ) { alpha = alpha * rand ; betaq = Math . pow ( alpha , 1.0 / ( distributionIndex + 1.0 ) ) ; } else { alpha = alpha * rand ; alpha = 1.0 / ( 2.0 - alpha ) ; betaq = Math . pow ( alpha , 1.0 / ( distributionIndex + 1.0 ) ) ; } x1 = 0.5 * ( ( y1 + y2 ) - betaq * ( y2 - y1 ) ) ; x2 = 0.5 * ( ( y1 + y2 ) + betaq * ( y2 - y1 ) ) ; if ( x1 < lb ) { x1 = lb ; } else if ( x1 > ub ) { x1 = ub ; } if ( x2 < lb ) { x2 = lb ; } else if ( x2 > ub ) { x2 = ub ; } if ( swap && PRNG . nextBoolean ( ) ) { double temp = x1 ; x1 = x2 ; x2 = temp ; } v1 . setValue ( x1 ) ; v2 . setValue ( x2 ) ; } }
evolves the specified variables using the sbx operator using symmetric distributions .
