Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/12 15:59:39 (12 years ago)
Author:
abeham
Message:

#1614, #1848

  • updated extension methods and operators that use them
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/GQAPPathRelinking.cs

    r7523 r7807  
    183183        if (B.Any()) {
    184184          GQAPSolution pi;
    185           if (maximization.Value) pi = B.ChooseProportionalRandom(random, 1, x => x.Quality.Value, false, true).First();
    186           else pi = B.ChooseProportionalRandom(random, 1, x => 1.0 / x.Quality.Value, false, true).First();
     185          if (maximization.Value) pi = B.SampleProportional(random, 1, B.Select(x => x.Quality.Value), false).First();
     186          else pi = B.SampleProportional(random, 1, B.Select(x => 1.0 / x.Quality.Value), false).First();
    187187          var diff = IntegerVectorEqualityComparer.GetDifferingIndices(pi.Assignment, target);
    188188          var I = phi.Except(diff);
    189           var i = I.ChooseUniformRandom(random);
     189          var i = I.SampleRandom(random);
    190190          fix.Add(i);
    191191          nonFix.Remove(i);
     
    226226          var T = nonFix.Where(x => x != equipment && assignment[x] == l && demands[x] <= maxSlack);
    227227          if (T.Any()) {
    228             int i = T.ChooseProportionalRandom(random, 1, x => demands[x], false, true).First();
    229             var j = Enumerable.Range(0, capacities.Length).Where(x => slack[x] >= demands[i]).ChooseUniformRandom(random);
     228            int i = T.SampleProportional(random, 1, T.Select(x => demands[x]), false).First();
     229            var j = Enumerable.Range(0, capacities.Length).Where(x => slack[x] >= demands[i]).SampleRandom(random);
    230230            result[i] = j;
    231231            slack[j] -= demands[i];
Note: See TracChangeset for help on using the changeset viewer.