Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2919


Ignore:
Timestamp:
03/03/10 14:44:49 (15 years ago)
Author:
abeham
Message:

fixed a possible bug in SBX #890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVector/3.3/Crossovers/SimulatedBinaryCrossover.cs

    r2918 r2919  
    7070          if (u < 0.5) { // if u is smaller than 0.5 perform a contracting crossover
    7171            beta = Math.Pow(2 * u, 1.0 / (contiguity.Value + 1));
    72           } else { // otherwise perform an expanding crossover
     72          } else if (u > 0.5) { // otherwise perform an expanding crossover
    7373            beta = Math.Pow(1.0 / (2 - 2 * u), (contiguity.Value + 1));
    74           }
     74          } else if (u == 0.5)
     75            beta = 1;
     76
    7577          if (random.NextDouble() < 0.5)
    7678            result[i] = ((parent1[i] + parent2[i]) / 2.0) - beta * 0.5 * Math.Abs(parent1[i] - parent2[i]);
Note: See TracChangeset for help on using the changeset viewer.