Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/12 16:42:17 (12 years ago)
Author:
jkarder
Message:

#1331:

  • added analyzer
  • added parameters and adjusted parameter types
  • corrected ReferenceSetUpdateMethod
  • changed access levels
File:
1 edited

Legend:

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

    r7722 r7724  
    4242      get { return (ValueLookupParameter<BoolValue>)Parameters["NewSolutions"]; }
    4343    }
     44    private ValueLookupParameter<IntValue> ReferenceSetSizeParameter {
     45      get { return (ValueLookupParameter<IntValue>)Parameters["ReferenceSetSize"]; }
     46    }
    4447    #endregion
    4548
    4649    #region Properties
    47     public IScope CurrentScope {
     50    private IScope CurrentScope {
    4851      get { return CurrentScopeParameter.ActualValue; }
    4952    }
    50     public BoolValue NewSolutions {
     53    private BoolValue NewSolutions {
    5154      get { return NewSolutionsParameter.ActualValue; }
     55    }
     56    private IntValue ReferenceSetSize {
     57      get { return ReferenceSetSizeParameter.ActualValue; }
     58      set { ReferenceSetSizeParameter.ActualValue = value; }
    5259    }
    5360    #endregion
     
    6471    private void Initialize() {
    6572      #region Create parameters
     73      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
    6674      Parameters.Add(new ValueLookupParameter<BoolValue>("NewSolutions", "Indicates if new solutions have been found."));
    67       Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
     75      Parameters.Add(new ValueLookupParameter<IntValue>("ReferenceSetSize", "The size of the reference set."));
    6876      #endregion
    6977
     
    8694      if ((offspring.SubScopes.OrderByDescending(o => o.Variables["Quality"].Value).First().Variables["Quality"].Value as DoubleValue).Value
    8795          > (parents.SubScopes.OrderByDescending(o => o.Variables["Quality"].Value).First().Variables["Quality"].Value as DoubleValue).Value) {
    88         CurrentScope.SubScopes.Replace(CurrentScope.SubScopes.Union(offspring.SubScopes).OrderByDescending(o => o.Variables["Quality"].Value).Take(10));
     96        CurrentScope.SubScopes.Replace(CurrentScope.SubScopes.Union(offspring.SubScopes).OrderByDescending(o => o.Variables["Quality"].Value).Take(ReferenceSetSize.Value));
    8997        NewSolutions.Value = true;
    9098      }
Note: See TracChangeset for help on using the changeset viewer.