Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/22/12 11:11:38 (12 years ago)
Author:
jkarder
Message:

#1331:

  • synced branch with trunk
  • added custom interface (ISimilarityBasedOperator) to mark operators that conduct similarity calculation
  • similarity calculators are now parameterized by the algorithm
  • deleted SolutionPool2TierUpdateMethod
  • deleted KnapsackMultipleGuidesPathRelinker
  • moved IImprovementOperator, IPathRelinker and ISimilarityCalculator to HeuristicLab.Optimization
  • added parameter descriptions
  • fixed plugin references
  • fixed count of EvaluatedSolutions
  • fixed check for duplicate solutions
  • minor code improvements
Location:
branches/ScatterSearch (trunk integration)
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)

  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs

    r7954 r8086  
    9292      get { return (IValueLookupParameter<ISimilarityCalculator>)Parameters["SimilarityCalculator"]; }
    9393    }
    94     public IValueLookupParameter<ISolutionCreator> SolutionCreatorParameter {
    95       get { return (IValueLookupParameter<ISolutionCreator>)Parameters["SolutionCreator"]; }
    96     }
    9794    public IValueLookupParameter<IItem> TargetParameter {
    9895      get { return (IValueLookupParameter<IItem>)Parameters["Target"]; }
     
    173170      set { SimilarityCalculatorParameter.ActualValue = value; }
    174171    }
    175     private ISolutionCreator SolutionCreator {
    176       get { return SolutionCreatorParameter.ActualValue; }
    177       set { SolutionCreatorParameter.ActualValue = value; }
    178     }
    179172    private IItem Target {
    180173      get { return TargetParameter.ActualValue; }
     
    194187    private void Initialize() {
    195188      #region Create parameters
    196       Parameters.Add(new ValueLookupParameter<IMultiAnalyzer>("Analyzer"));
    197       Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality"));
    198       Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover"));
    199       Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions"));
    200       Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator"));
    201       Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking"));
    202       Parameters.Add(new ValueLookupParameter<IImprovementOperator>("Improver"));
    203       Parameters.Add(new ValueLookupParameter<IntValue>("Iterations"));
    204       Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization"));
    205       Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations"));
    206       Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfHighQualitySolutions"));
    207       Parameters.Add(new ValueLookupParameter<IPathRelinker>("PathRelinker"));
    208       Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize"));
    209       Parameters.Add(new ValueLookupParameter<IntValue>("ReferenceSetSize"));
    210       Parameters.Add(new ValueLookupParameter<DoubleValue>("Quality"));
    211       Parameters.Add(new ValueLookupParameter<IRandom>("Random"));
    212       Parameters.Add(new ValueLookupParameter<VariableCollection>("Results"));
    213       Parameters.Add(new ValueLookupParameter<ISimilarityCalculator>("SimilarityCalculator"));
    214       Parameters.Add(new ValueLookupParameter<ISolutionCreator>("SolutionCreator"));
    215       Parameters.Add(new ValueLookupParameter<IItem>("Target"));
     189      Parameters.Add(new ValueLookupParameter<IMultiAnalyzer>("Analyzer", "The analyzer used to analyze each iteration."));
     190      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality", "The best known quality value found so far."));
     191      Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     192      Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated."));
     193      Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
     194      Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking", "True if path relinking should be executed instead of crossover, otherwise false."));
     195      Parameters.Add(new ValueLookupParameter<IImprovementOperator>("Improver", "The operator used to improve solutions."));
     196      Parameters.Add(new ValueLookupParameter<IntValue>("Iterations", "The number of iterations performed."));
     197      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
     198      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed."));
     199      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfHighQualitySolutions", "The number of high quality solutions in the reference set."));
     200      Parameters.Add(new ValueLookupParameter<IPathRelinker>("PathRelinker", "The operator used to execute path relinking."));
     201      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
     202      Parameters.Add(new ValueLookupParameter<IntValue>("ReferenceSetSize", "The size of the reference set."));
     203      Parameters.Add(new ValueLookupParameter<DoubleValue>("Quality", "This parameter is used for name translation only."));
     204      Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator."));
     205      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     206      Parameters.Add(new ValueLookupParameter<ISimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions."));
     207      Parameters.Add(new ValueLookupParameter<IItem>("Target", "This parameter is used for name translation only."));
    216208      #endregion
    217209
     
    239231      SolutionPoolUpdateMethod solutionPoolUpdateMethod = new SolutionPoolUpdateMethod();
    240232      SolutionsCreator solutionsCreator = new SolutionsCreator();
    241       SubScopesCounter subScopesCounter1 = new SubScopesCounter();
    242       SubScopesCounter subScopesCounter2 = new SubScopesCounter();
     233      DataReducer dataReducer1 = new DataReducer();
     234      DataReducer dataReducer2 = new DataReducer();
    243235      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
    244236      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
    245237      SubScopesProcessor subScopesProcessor3 = new SubScopesProcessor();
     238      SubScopesProcessor subScopesProcessor4 = new SubScopesProcessor();
    246239      ConditionalBranch terminateBranch = new ConditionalBranch();
    247240      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
     
    253246      #region Create operator graph
    254247      OperatorGraph.InitialOperator = variableCreator;
    255       variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
     248      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>(IterationsParameter.Name, new IntValue(0)));
    256249      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("NewSolutions", new BoolValue(false)));
    257250      variableCreator.Successor = resultsCollector;
     
    264257      iterationsChecker.Name = "IterationsChecker";
    265258      iterationsChecker.Comparison.Value = ComparisonType.GreaterOrEqual;
    266       iterationsChecker.LeftSideParameter.ActualName = "Iterations";
    267       iterationsChecker.RightSideParameter.ActualName = "MaximumIterations";
     259      iterationsChecker.LeftSideParameter.ActualName = IterationsParameter.Name;
     260      iterationsChecker.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    268261      iterationsChecker.ResultParameter.ActualName = "Terminate";
    269262      iterationsChecker.Successor = terminateBranch;
     
    273266      terminateBranch.FalseBranch = referenceSetUpdateMethod;
    274267
    275       referenceSetUpdateMethod.TargetParameter.ActualName = TargetParameter.ActualName;
    276268      referenceSetUpdateMethod.Successor = assigner1;
    277269
     
    305297
    306298      pathRelinker.Name = "PathRelinker";
    307       pathRelinker.OperatorParameter.ActualName = "PathRelinker";
     299      pathRelinker.OperatorParameter.ActualName = PathRelinkerParameter.Name;
    308300      pathRelinker.Successor = offspringProcessor;
    309301
    310302      crossover.Name = "Crossover";
    311       crossover.OperatorParameter.ActualName = "Crossover";
     303      crossover.OperatorParameter.ActualName = CrossoverParameter.Name;
    312304      crossover.Successor = offspringProcessor;
    313305
     
    326318      uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(2);
    327319      uniformSubScopesProcessor2.Operator = solutionImprover1;
    328       uniformSubScopesProcessor2.Successor = subScopesCounter1;
     320      uniformSubScopesProcessor2.Successor = subScopesProcessor4;
    329321
    330322      solutionImprover1.Name = "SolutionImprover";
    331       solutionImprover1.OperatorParameter.ActualName = "Improver";
     323      solutionImprover1.OperatorParameter.ActualName = ImproverParameter.Name;
    332324      solutionImprover1.Successor = solutionEvaluator1;
    333325
    334326      solutionEvaluator1.Name = "SolutionEvaluator";
    335       solutionEvaluator1.OperatorParameter.ActualName = "Evaluator";
    336 
    337       subScopesCounter1.Name = "Increment EvaluatedSolutions";
    338       subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
     327      solutionEvaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name;
     328
     329      subScopesProcessor4.Operators.Add(dataReducer1);
     330
     331      dataReducer1.Name = "Increment EvaluatedSolutions";
     332      dataReducer1.ParameterToReduce.ActualName = "LocalEvaluatedSolutions";
     333      dataReducer1.TargetParameter.ActualName = EvaluatedSolutionsParameter.Name;
     334      dataReducer1.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
     335      dataReducer1.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
    339336
    340337      solutionPoolUpdateMethod.QualityParameter.ActualName = QualityParameter.ActualName;
    341       solutionPoolUpdateMethod.TargetParameter.ActualName = TargetParameter.ActualName;
    342338      solutionPoolUpdateMethod.Successor = analyzer;
    343339
    344340      analyzer.Name = "Analyzer";
    345       analyzer.OperatorParameter.ActualName = "Analyzer";
     341      analyzer.OperatorParameter.ActualName = AnalyzerParameter.Name;
    346342
    347343      newSolutionsBranch.Name = "NewSolutionsChecker";
     
    359355
    360356      solutionsCreator.Name = "DiversificationGenerationMethod";
    361       solutionsCreator.NumberOfSolutionsParameter.ActualName = "PopulationSize";
     357      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    362358      solutionsCreator.Successor = uniformSubScopesProcessor3;
    363359
    364360      uniformSubScopesProcessor3.DepthParameter.Value = new IntValue(1);
    365361      uniformSubScopesProcessor3.Operator = solutionImprover2;
    366       uniformSubScopesProcessor3.Successor = subScopesCounter2;
     362      uniformSubScopesProcessor3.Successor = dataReducer2;
    367363
    368364      solutionImprover2.Name = "SolutionImprover";
    369       solutionImprover2.OperatorParameter.ActualName = "Improver";
     365      solutionImprover2.OperatorParameter.ActualName = ImproverParameter.Name;
    370366      solutionImprover2.Successor = solutionEvaluator2;
    371367
    372368      solutionEvaluator2.Name = "SolutionEvaluator";
    373       solutionEvaluator2.OperatorParameter.ActualName = "Evaluator";
    374 
    375       subScopesCounter2.Name = "Increment EvaluatedSolutions";
    376       subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
     369      solutionEvaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name;
     370
     371      dataReducer2.Name = "Increment EvaluatedSolutions";
     372      dataReducer2.ParameterToReduce.ActualName = "LocalEvaluatedSolutions";
     373      dataReducer2.TargetParameter.ActualName = EvaluatedSolutionsParameter.Name;
     374      dataReducer2.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
     375      dataReducer2.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
    377376
    378377      iterationsCounter.Name = "IterationCounter";
    379378      iterationsCounter.IncrementParameter.Value = new IntValue(1);
    380       iterationsCounter.ValueParameter.ActualName = "Iterations";
     379      iterationsCounter.ValueParameter.ActualName = IterationsParameter.Name;
    381380      iterationsCounter.Successor = resultsCollector;
    382381      #endregion
Note: See TracChangeset for help on using the changeset viewer.