Changeset 7954


Ignore:
Timestamp:
06/04/12 16:48:59 (7 years ago)
Author:
jkarder
Message:

#1331:

  • added EvaluatedSolutions parameter
  • SingleObjectiveTestFunctionImprovementOperator now retrieves the bounds from the scope tree
  • SingleObjectiveTestFunctionProblem now assigns the bounds to the similarity calculator
Location:
branches/ScatterSearch (trunk integration)
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs

    r7789 r7954  
    194194      Placeholder solutionEvaluator = new Placeholder();
    195195      Placeholder solutionImprover = new Placeholder();
     196      SubScopesCounter subScopesCounter = new SubScopesCounter();
     197      ResultsCollector resultsCollector = new ResultsCollector();
    196198      BestSelector bestSelector = new BestSelector();
    197199      ScatterSearchMainLoop mainLoop = new ScatterSearchMainLoop();
     
    210212
    211213      uniformSubScopesProcessor.Operator = solutionImprover;
    212       uniformSubScopesProcessor.Successor = bestSelector;
     214      uniformSubScopesProcessor.Successor = subScopesCounter;
    213215
    214216      solutionImprover.Name = "SolutionImprover";
     
    219221      solutionEvaluator.OperatorParameter.ActualName = "Evaluator";
    220222      solutionEvaluator.Successor = null;
     223
     224      subScopesCounter.Name = "Initialize EvaluatedSolutions";
     225      subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
     226      subScopesCounter.Successor = resultsCollector;
     227
     228      resultsCollector.Name = "ResultsCollector";
     229      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions", null, "EvaluatedSolutions"));
     230      resultsCollector.Successor = bestSelector;
    221231
    222232      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = NumberOfHighQualitySolutionsParameter.Name;
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearchMainLoop.cs

    r7789 r7954  
    4747      get { return (IValueLookupParameter<ICrossover>)Parameters["Crossover"]; }
    4848    }
     49    public IValueLookupParameter<IntValue> EvaluatedSolutionsParameter {
     50      get { return (IValueLookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
     51    }
    4952    public IValueLookupParameter<IEvaluator> EvaluatorParameter {
    5053      get { return (IValueLookupParameter<IEvaluator>)Parameters["Evaluator"]; }
     
    109112      get { return CrossoverParameter.ActualValue; }
    110113      set { CrossoverParameter.ActualValue = value; }
     114    }
     115    private IntValue EvaluatedSolutions {
     116      get { return EvaluatedSolutionsParameter.ActualValue; }
     117      set { EvaluatedSolutionsParameter.ActualValue = value; }
    111118    }
    112119    private IEvaluator Evaluator {
     
    190197      Parameters.Add(new ValueLookupParameter<DoubleValue>("BestKnownQuality"));
    191198      Parameters.Add(new ValueLookupParameter<ICrossover>("Crossover"));
     199      Parameters.Add(new ValueLookupParameter<IntValue>("EvaluatedSolutions"));
    192200      Parameters.Add(new ValueLookupParameter<IEvaluator>("Evaluator"));
    193201      Parameters.Add(new ValueLookupParameter<BoolValue>("ExecutePathRelinking"));
     
    231239      SolutionPoolUpdateMethod solutionPoolUpdateMethod = new SolutionPoolUpdateMethod();
    232240      SolutionsCreator solutionsCreator = new SolutionsCreator();
     241      SubScopesCounter subScopesCounter1 = new SubScopesCounter();
     242      SubScopesCounter subScopesCounter2 = new SubScopesCounter();
    233243      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
    234244      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     
    316326      uniformSubScopesProcessor2.DepthParameter.Value = new IntValue(2);
    317327      uniformSubScopesProcessor2.Operator = solutionImprover1;
     328      uniformSubScopesProcessor2.Successor = subScopesCounter1;
    318329
    319330      solutionImprover1.Name = "SolutionImprover";
     
    323334      solutionEvaluator1.Name = "SolutionEvaluator";
    324335      solutionEvaluator1.OperatorParameter.ActualName = "Evaluator";
     336
     337      subScopesCounter1.Name = "Increment EvaluatedSolutions";
     338      subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    325339
    326340      solutionPoolUpdateMethod.QualityParameter.ActualName = QualityParameter.ActualName;
     
    350364      uniformSubScopesProcessor3.DepthParameter.Value = new IntValue(1);
    351365      uniformSubScopesProcessor3.Operator = solutionImprover2;
     366      uniformSubScopesProcessor3.Successor = subScopesCounter2;
    352367
    353368      solutionImprover2.Name = "SolutionImprover";
     
    357372      solutionEvaluator2.Name = "SolutionEvaluator";
    358373      solutionEvaluator2.OperatorParameter.ActualName = "Evaluator";
     374
     375      subScopesCounter2.Name = "Increment EvaluatedSolutions";
     376      subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    359377
    360378      iterationsCounter.Name = "IterationCounter";
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/Improvers/SingleObjectiveTestFunctionImprovementOperator.cs

    r7789 r7954  
    4545      get { return (IValueParameter<DoubleValue>)Parameters["Beta"]; }
    4646    }
     47    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
     48      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
     49    }
    4750    public ScopeParameter CurrentScopeParameter {
    4851      get { return (ScopeParameter)Parameters["CurrentScope"]; }
     
    7477    private DoubleValue Beta {
    7578      get { return BetaParameter.Value; }
     79    }
     80    private DoubleMatrix Bounds {
     81      get { return BoundsParameter.ActualValue; }
    7682    }
    7783    public IScope CurrentScope {
     
    109115      Parameters.Add(new ValueParameter<DoubleValue>("Alpha", new DoubleValue(1.0)));
    110116      Parameters.Add(new ValueParameter<DoubleValue>("Beta", new DoubleValue(2.0)));
     117      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds"));
    111118      Parameters.Add(new ScopeParameter("CurrentScope"));
    112119      Parameters.Add(new ValueParameter<DoubleValue>("Delta", new DoubleValue(0.5)));
     
    136143      for (int i = 0; i < simplex.Length; i++) {
    137144        simplex[i] = bestSol.Clone() as RealVector;
    138         simplex[i][i] += 0.1 * (Evaluator.Bounds[0, 1] - Evaluator.Bounds[0, 0]);
    139         if (simplex[i][i] > Evaluator.Bounds[0, 1]) simplex[i][i] = Evaluator.Bounds[0, 1];
    140         if (simplex[i][i] < Evaluator.Bounds[0, 0]) simplex[i][i] = Evaluator.Bounds[0, 0];
     145        simplex[i][i] += 0.1 * (Bounds[0, 1] - Bounds[0, 0]);
     146        if (simplex[i][i] > Bounds[0, 1]) simplex[i][i] = Bounds[0, 1];
     147        if (simplex[i][i] < Bounds[0, 0]) simplex[i][i] = Bounds[0, 0];
    141148      }
    142149
     
    195202
    196203      for (int i = 0; i < simplex[0].Length; i++) {
    197         if (simplex[0][i] > Evaluator.Bounds[0, 1]) simplex[0][i] = Evaluator.Bounds[0, 1];
    198         if (simplex[0][i] < Evaluator.Bounds[0, 0]) simplex[0][i] = Evaluator.Bounds[0, 0];
     204        if (simplex[0][i] > Bounds[0, 1]) simplex[0][i] = Bounds[0, 1];
     205        if (simplex[0][i] < Bounds[0, 0]) simplex[0][i] = Bounds[0, 0];
    199206      }
    200207
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs

    r7793 r7954  
    2626using HeuristicLab.Encodings.RealVectorEncoding;
    2727using HeuristicLab.Optimization.Operators;
    28 using HeuristicLab.Parameters;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    3635  [StorableClass]
    3736  public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SimilarityCalculator {
    38     #region Parameter properties
    39     public ILookupParameter<DoubleMatrix> BoundsParameter {
    40       get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
    41     }
    42     #endregion
    43 
    4437    #region Properties
    45     private DoubleMatrix Bounds {
    46       get { return BoundsParameter.ActualValue; }
    47       set { BoundsParameter.ActualValue = value; }
    48     }
     38    public DoubleMatrix Bounds { get; set; }
    4939    #endregion
    5040
     
    5242    private SingleObjectiveTestFunctionSimilarityCalculator(bool deserializing) : base(deserializing) { }
    5343    private SingleObjectiveTestFunctionSimilarityCalculator(SingleObjectiveTestFunctionSimilarityCalculator original, Cloner cloner) : base(original, cloner) { }
    54     public SingleObjectiveTestFunctionSimilarityCalculator()
    55       : base() {
    56       #region Create parameters
    57       Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds"));
    58       #endregion
    59     }
     44    public SingleObjectiveTestFunctionSimilarityCalculator() : base() { }
    6045
    6146    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs

    r7789 r7954  
    376376        op.ParentsParameter.Hidden = true;
    377377      }
    378       foreach (ISimilarityCalculator op in Operators.OfType<ISimilarityCalculator>()) {
     378      foreach (SingleObjectiveTestFunctionSimilarityCalculator op in Operators.OfType<ISimilarityCalculator>()) {
    379379        op.TargetParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
    380380        op.TargetParameter.Hidden = true;
     381        op.Bounds = Bounds;
    381382      }
    382383    }
Note: See TracChangeset for help on using the changeset viewer.