Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16479


Ignore:
Timestamp:
01/02/19 15:03:37 (6 years ago)
Author:
gkronber
Message:

#2520: checked and added StorableType attribute projects included in HeuristicLab 3.3.sln

Location:
branches/2520_PersistenceReintegration
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2520_PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs

    r16470 r16479  
    2929using HeuristicLab.Core;
    3030using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    31 using HEAL.Fossil;
    3231using HeuristicLab.Problems.DataAnalysis;
    3332using HeuristicLab.Problems.DataAnalysis.Symbolic;
  • branches/2520_PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/Distances/DistanceBase.cs

    r16470 r16479  
    2525using HeuristicLab.Core;
    2626using HEAL.Fossil;
    27 using HEAL.Fossil;
    2827
    2928namespace HeuristicLab.Algorithms.DataAnalysis {
     
    4443
    4544    public double Get(object x, object y) {
    46       return Get((T) x, (T) y);
     45      return Get((T)x, (T)y);
    4746    }
    4847
    4948    public IComparer GetDistanceComparer(object item) {
    50       return new DistanceComparer((T) item, this);
     49      return new DistanceComparer((T)item, this);
    5150    }
    5251
    5352    [StorableType("35fcecb5-9209-469b-9e4e-82efd8abfddf")]
    5453    internal class DistanceComparer : IComparer<T>, IComparer {
     54      [Storable]
    5555      private readonly T item;
     56      [Storable]
    5657      private readonly IDistance<T> dist;
     58
     59      [StorableConstructor]
     60      protected DistanceComparer(StorableConstructorFlag _) {
     61      }
    5762
    5863      public DistanceComparer(T item, IDistance<T> dist) {
  • branches/2520_PersistenceReintegration/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r16462 r16479  
    3535using HeuristicLab.Persistence.Default.Xml;
    3636using HeuristicLab.PluginInfrastructure;
     37using System.IO;
    3738
    3839namespace HeuristicLab.Scripting.Views {
     
    474475    private bool IsSerializable(KeyValuePair<string, object> variable) {
    475476      Type type = null;
    476       bool serializable;
     477      bool serializable = false;
    477478
    478479      if (variable.Value != null) {
    479480        type = variable.Value.GetType();
    480481        if (serializableLookup.TryGetValue(type, out serializable)) return serializable;
    481         if (StorableClassAttribute.IsStorableClass(type)) return serializableLookup[type] = true;
    482       }
    483 
    484       var ser = new Persistence.Core.Serializer(variable, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()), "ROOT", true);
     482        if (StorableTypeAttribute.IsStorableType(type)) return serializableLookup[type] = true;
     483      }
     484
     485      var ser = new ProtoBufSerializer();
    485486      try {
    486         serializable = ser.Count() > 0; // try to create all serialization tokens
     487        using (var memStream = new MemoryStream()) {
     488          ser.Serialize(variable.Value, memStream); // try to serialize to memory stream
     489          serializable = true;
     490        }
    487491      } catch (PersistenceException) {
    488492        serializable = false;
  • branches/2520_PersistenceReintegration/HeuristicLab.Selection/3.3/EvolutionStrategyOffspringSelector.cs

    r16462 r16479  
    3333  [StorableType("CE585C3C-5139-44F0-9CB2-CC901A290831")]
    3434  public class EvolutionStrategyOffspringSelector : SingleSuccessorOperator {
    35 
     35    [StorableType("F1CA99A7-E9C2-49F3-8030-5CEE407357AA")]
    3636    private class FitnessComparer : IComparer<IScope> {
    3737
    3838      #region IComparer<IScope> Member
    39 
    40       private String qualityParameterName;
     39      [Storable]
     40      private string qualityParameterName;
     41      [Storable]
    4142      private bool maximization;
    4243
    43       public FitnessComparer(String qualityParamName, bool maximization) {
     44      [StorableConstructor]
     45      protected FitnessComparer(StorableConstructorFlag _) { }
     46
     47      public FitnessComparer(string qualityParamName, bool maximization) {
    4448        this.qualityParameterName = qualityParamName;
    4549        this.maximization = maximization;
Note: See TracChangeset for help on using the changeset viewer.