Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7778


Ignore:
Timestamp:
05/03/12 10:51:24 (13 years ago)
Author:
jkarder
Message:

#1331: added support for path relinking operators that use a multiple guiding strategy

Location:
branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackMultipleGuidesPathRelinker.cs

    r7775 r7778  
    7979
    8080    protected override ItemArray<IItem> Relink(ItemArray<IItem> parents, PercentValue n) {
    81       if (parents.Length != 2)
    82         throw new ArgumentException("The number of parents is not equal to 2.");
     81      if (parents.Length < 2)
     82        throw new ArgumentException("The number of parents is smaller than 2.");
    8383      return Apply(parents[0], parents.Skip(1).ToArray(), n);
    8484    }
  • branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs

    r7775 r7778  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Selection;
    3031
    3132namespace HeuristicLab.Algorithms.ScatterSearch {
     
    199200      ConditionalBranch terminateBranch = new ConditionalBranch();
    200201      IntCounter interationsCounter = new IntCounter();
     202      MergingReducer mergingReducer = new MergingReducer();
    201203      OffspringProcessor offspringProcessor = new OffspringProcessor();
    202204      Placeholder analyzer = new Placeholder();
     
    209211      ResultsCollector resultsCollector = new ResultsCollector();
    210212      ReferenceSetUpdateMethod referenceSetUpdateMethod = new ReferenceSetUpdateMethod();
     213      RightSelector rightSelector = new RightSelector();
    211214      SolutionPoolUpdateMethod solutionPoolUpdateMethod = new SolutionPoolUpdateMethod();
    212215      SolutionsCreator solutionsCreator = new SolutionsCreator();
     
    267270      interationsCounter.Successor = resultsCollector;
    268271
    269       offspringProcessor.Successor = subScopesProcessor2;
     272      offspringProcessor.Successor = rightSelector;
     273
     274      rightSelector.NumberOfSelectedSubScopesParameter.Value = new IntValue(1);
     275      rightSelector.CopySelected = new BoolValue(false);
     276      rightSelector.Successor = subScopesProcessor2;
    270277
    271278      analyzer.Name = "Analyzer";
     
    307314      subScopesProcessor2.DepthParameter.Value = new IntValue(1);
    308315      subScopesProcessor2.Operators.Add(new EmptyOperator());
    309       subScopesProcessor2.Operators.Add(new EmptyOperator());
    310316      subScopesProcessor2.Operators.Add(uniformSubScopesProcessor2);
    311       subScopesProcessor2.Successor = null;
     317      subScopesProcessor2.Successor = mergingReducer;
    312318
    313319      subScopesProcessor3.DepthParameter.Value = new IntValue(1);
     
    320326      uniformSubScopesProcessor1.Successor = solutionPoolUpdateMethod;
    321327
    322       uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(1);
     328      uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(2);
    323329      uniformSubScopesProcessor2.Operator = solutionImprover1;
    324330      uniformSubScopesProcessor2.Successor = null;
  • branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/TravelingSalesman/TravelingSalesmanMultipleGuidesPathRelinker.cs

    r7775 r7778  
    123123
    124124    protected override ItemArray<IItem> Relink(ItemArray<IItem> parents, PercentValue n) {
    125       if (parents.Length != 2)
    126         throw new ArgumentException("The number of parents is not equal to 2.");
     125      if (parents.Length < 2)
     126        throw new ArgumentException("The number of parents is smaller than 2.");
    127127      return Apply(parents[0], parents.Skip(1).ToArray(), DistanceMatrix, n);
    128128    }
Note: See TracChangeset for help on using the changeset viewer.