Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/09 01:21:53 (15 years ago)
Author:
swagner
Message:

Refactoring of crossover operators (#470)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SimOpt/SimOptSinglePointCrossover.cs

    r637 r1218  
    4040    }
    4141
    42     protected override void Cross(IScope scope, IRandom random, IScope parent1, IScope parent2, IScope child) {
     42    protected override void Cross(IScope scope, IRandom random) {
    4343      ICollection<IConstraint> violated;
    44       ConstrainedItemList p1 = parent1.GetVariableValue<ConstrainedItemList>("Item", false);
    45       ConstrainedItemList p2 = parent2.GetVariableValue<ConstrainedItemList>("Item", false);
     44      ConstrainedItemList p1 = scope.SubScopes[0].GetVariableValue<ConstrainedItemList>("Item", false);
     45      ConstrainedItemList p2 = scope.SubScopes[1].GetVariableValue<ConstrainedItemList>("Item", false);
    4646
    4747      if (p1.Count != p2.Count) throw new InvalidOperationException("ERROR: the lists do not contain the same number of items");
     
    5858        } while (!childList.EndCombinedOperation(out violated) && ++iter < 100);
    5959        if (violated.Count == 0) {
    60           child.AddVariable(new Variable(parent1.TranslateName("Item"), childList));
     60          scope.AddVariable(new Variable(scope.SubScopes[0].TranslateName("Item"), childList));
    6161        }
    6262      }
Note: See TracChangeset for help on using the changeset viewer.