Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16860 for trunk


Ignore:
Timestamp:
04/20/19 23:28:49 (6 years ago)
Author:
abeham
Message:

#2855: Reduced footprint of encoding in run

  • Instead of the encoding instance, only its name is added to the run (necessary to change in BasicProblem)
  • By default the operators parameter of an encoding is set to not be collected (change in Encoding)
Location:
trunk/HeuristicLab.Optimization/3.3/BasicProblems
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs

    r16565 r16860  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     28using HeuristicLab.Data;
    2729using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2930
    3031namespace HeuristicLab.Optimization {
     
    157158      OnOperatorsChanged();
    158159    }
     160
     161    protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IValueParameter param) {
     162      if (param.Value == null) yield break;
     163      if (param.GetsCollected) {
     164        if (param == EncodingParameter) // store only the name of the encoding
     165          yield return new KeyValuePair<string, IItem>(String.Empty, new StringValue(EncodingParameter.Value.Name));
     166        else yield return new KeyValuePair<string, IItem>(String.Empty, param.Value);
     167      }
     168      var parameterizedItem = param.Value as IParameterizedItem;
     169      if (parameterizedItem != null) {
     170        var children = new Dictionary<string, IItem>();
     171        parameterizedItem.CollectParameterValues(children);
     172        foreach (var child in children) yield return child;
     173      }
     174    }
    159175  }
    160176}
  • trunk/HeuristicLab.Optimization/3.3/BasicProblems/Encoding.cs

    r16565 r16860  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Optimization {
     
    9292    protected Encoding(string name)
    9393      : base(name) {
    94       Parameters.Add(new FixedValueParameter<ReadOnlyItemSet<IOperator>>(name + ".Operators", "The operators that the encoding specifies.", encodingOperators.AsReadOnly()));
     94      Parameters.Add(new FixedValueParameter<ReadOnlyItemSet<IOperator>>(name + ".Operators", "The operators that the encoding specifies.", encodingOperators.AsReadOnly()) {
     95        GetsCollected = false
     96      });
    9597    }
    9698
Note: See TracChangeset for help on using the changeset viewer.