Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14713 for branches


Ignore:
Timestamp:
03/03/17 18:41:01 (8 years ago)
Author:
gkronber
Message:

#2520 work in progress to support loading/saving of all samples

Location:
branches/PersistenceOverhaul
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceOverhaul/HeuristicLab.Algorithms.ALPS/3.3/AgingScheme.cs

    r14712 r14713  
    2424using System.Linq;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
    2728namespace HeuristicLab.Algorithms.ALPS {
     
    2930  /// Defines the growth of age limits for the layers.
    3031  /// </summary>
     32  [StorableType("58FBD063-B765-439D-BEC8-C718E6877EBD")] 
    3133  public enum AgingScheme {
    3234    Linear,
  • branches/PersistenceOverhaul/HeuristicLab.Optimization.Operators/3.3/NoSimilarityCalculator.cs

    r14712 r14713  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2425
    2526namespace HeuristicLab.Optimization.Operators {
     
    3031  /// The item always considers two solutions to be distinct.
    3132  /// </remarks>
     33  [StorableType("88771671-7DEF-4E1D-89F1-851E05F1BCA3")]       
    3234  [Item("NoSimilarityCalculator", "An item that performs similarity calculation between two solutions. The item always considers two solutions to be distinct.")]
    3335  public sealed class NoSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
  • branches/PersistenceOverhaul/HeuristicLab.Optimization.Operators/3.3/QualitySimilarityCalculator.cs

    r14712 r14713  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
    2728namespace HeuristicLab.Optimization.Operators {
     
    3233  /// The item always considers two solutions to be equal if they have the same quality.
    3334  /// </remarks>
     35  [StorableType("64D9B8A0-D350-4B31-B56B-2EE7DAA8E970")]
    3436  [Item("QualitySimilarityCalculator", "An item that performs similarity calculation between two solutions. The item only considers the qualities of the two solutions.")]
    3537  public sealed class QualitySimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r14711 r14713  
    2121
    2222using System;
     23using System.CodeDom;
    2324using System.Collections.Generic;
    2425using System.Linq;
     
    6970    /// </returns>
    7071    public bool CanSerialize(Type type) {
    71       var markedStorable = StorableReflection.HasStorableClassAttribute(type);
     72      var markedStorable = StorableReflection.HasStorableClassAttribute(type) && !type.IsEnum && !type.IsValueType;
    7273      if (GetConstructor(type) == null)
    7374        if (markedStorable)
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StaticCache.cs

    r14711 r14713  
    113113      // RegisterType(new Guid("3B3AA69E-1641-4202-AE1D-7EEFF60FA355"), typeof(double[]));
    114114      // RegisterType(new Guid("7DF325A6-2553-4915-B7C6-D98191107CB7"), typeof(string[]));
     115
     116      RegisterType(new Guid("E451A99B-0CFD-48E6-9BEF-0AE9D1E73628"), typeof(IList));                                       
    115117      RegisterType(new Guid("DB2A785C-5803-42C7-A01F-E1FD845A83A1"), typeof(List<>));
    116118      RegisterType(new Guid("EB98A564-BEDC-458A-9E9B-4BF3CDAFB9BE"), typeof(Stack<>));
     
    121123      RegisterType(new Guid("7E2F3277-7216-4295-A498-9ACA43527D5B"), typeof(HashSet<>));
    122124      RegisterType(new Guid("E92C35AD-32B1-4F37-B8D2-BE2F5FEB465B"), typeof(Dictionary<,>));
     125      RegisterType(new Guid("18504ADF-2332-4497-8CA0-B2F00CA2EBA2"), typeof(Type));
    123126
    124127      var allTypes = new Dictionary<string, Type>(5000);
     
    162165      RegisterType(new Guid("00C8C940-63D9-43FF-99BA-9C69301BF043"), allTypes["System.Collections.Generic.RandomizedObjectEqualityComparer"]);
    163166      RegisterType(new Guid("DAF22757-7FCC-49AC-B148-F3DD7E9E0A3B"), allTypes["System.Collections.Generic.IEqualityComparer`1"]);
    164 
    165167
    166168      //var registeredTypes = type2Guid.Keys.ToArray();
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/StorableClassTransformer.cs

    r14711 r14713  
    3030  internal sealed class StorableClassBoxTransformer : BoxTransformer<object> {
    3131    public override bool CanTransformType(Type type) {
    32       return StorableTypeAttribute.IsStorableType(type) && !type.IsValueType || // don't transform structs
     32      return StorableTypeAttribute.IsStorableType(type) && !type.IsValueType && !type.IsEnum || // don't transform structs or enums
    3333        type.BaseType != null && CanTransformType(type.BaseType);
    3434    }
  • branches/PersistenceOverhaul/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSolutionsAnalyzer.cs

    r12012 r14713  
    3333
    3434namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     35  [StorableType("604417B8-FBAD-407C-8482-D39959159551")]
    3536  public class SymbolicRegressionSolutionsAnalyzer : SingleSuccessorOperator, IAnalyzer {
    3637    private const string ResultCollectionParameterName = "Results";
  • branches/PersistenceOverhaul/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs

    r12422 r14713  
    3434                                 "- Randomly choose a node N from P1\n" +
    3535                                 "- Test all crossover points from P0 to determine the best location for N to be inserted")]
     36  [StorableType("510A36FF-584C-40F6-B3E0-5D7B0F85D761")]               
    3637  public sealed class SymbolicDataAnalysisExpressionContextAwareCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3738    [StorableConstructor]
  • branches/PersistenceOverhaul/HeuristicLab.Problems.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs

    r12070 r14713  
    2525using HeuristicLab.Encodings.BinaryVectorEncoding;
    2626using HeuristicLab.Optimization.Operators;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
    2829namespace HeuristicLab.Problems.Knapsack {
     
    3435  /// </remarks>
    3536  [Item("KnapsackSimilarityCalculator", "An operator that performs similarity calculation between two knapsack solutions. The operator calculates the similarity based on the number of elements the two solutions have in common.")]
     37  [StorableType("E335A90A-13BB-48C6-9BD3-4D183E8EB370")]
    3638  public sealed class KnapsackSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
    3739    protected override bool IsCommutative { get { return true; } }
  • branches/PersistenceOverhaul/HeuristicLab.Problems.QuadraticAssignment/3.3/QAPSimilarityCalculator.cs

    r12070 r14713  
    2525using HeuristicLab.Encodings.PermutationEncoding;
    2626using HeuristicLab.Optimization.Operators;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
    2829namespace HeuristicLab.Problems.QuadraticAssignment {
     
    3435  /// </remarks>
    3536  [Item("QAPSimilarityCalculator", "An operator that performs similarity calculation between two quadratic assignment solutions. The operator calculates the similarity based on the number of edges the two solutions have in common.")]
     37  [StorableType("EC8B94E6-EA4D-4EA4-86E5-9386F5CE54FE")]
    3638  public sealed class QAPSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
    3739    protected override bool IsCommutative { get { return true; } }
  • branches/PersistenceOverhaul/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators/TSPSimilarityCalculator.cs

    r12070 r14713  
    2525using HeuristicLab.Encodings.PermutationEncoding;
    2626using HeuristicLab.Optimization.Operators;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
    2829namespace HeuristicLab.Problems.TravelingSalesman {
     
    3334  /// The operator calculates the similarity based on the number of edges the two solutions have in common.
    3435  /// </remarks>
     36  [StorableType("D5AD7A09-5738-4F14-AB3C-4943C32FACC6")]   
    3537  [Item("TSPSimilarityCalculator", "An operator that performs similarity calculation between two traveling salesman solutions. The operator calculates the similarity based on the number of edges the two solutions have in common.")]
    3638  public sealed class TSPSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
  • branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs

    r14711 r14713  
    3232using System.Threading.Tasks;
    3333using HeuristicLab.Algorithms.GeneticAlgorithm;
     34using HeuristicLab.Common;
    3435using HeuristicLab.Data;
    3536using HeuristicLab.Persistence;
     
    403404
    404405    public string Profile(Func<object> GenerateDataFunc) {
    405       int nrOfRepetitions = 30;
     406      int nrOfRepetitions = 1;
    406407      StringBuilder report = new StringBuilder();
    407408      List<PerformanceData> dataList = new List<PerformanceData>();
     
    21342135      foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) {
    21352136        var original = XmlParser.Deserialize(fileName);
    2136         serializer.Serialize(original, fileName + ".proto");
    2137         // var newVersion = serializer.Deserialize(fileName + ".proto");
    2138         var p = Profile(() => original);
    2139         Console.WriteLine(p);
     2137        var ok = true;
     2138        foreach (var t in original.GetObjectGraphObjects().Select(o => o.GetType())) {
     2139          if (
     2140            t.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
     2141              .Any(ctor => StorableConstructorAttribute.IsStorableConstructor(ctor))) {
     2142            try {
     2143              if (t.IsGenericType)
     2144              {
     2145                var g = Mapper.StaticCache.GetGuid(t.GetGenericTypeDefinition());
     2146              }
     2147              else
     2148              {
     2149                var g = Mapper.StaticCache.GetGuid(t);
     2150              }
     2151            } catch (Exception e) {
     2152              Console.WriteLine(t.FullName);
     2153              ok = false;
     2154            }
     2155          }
     2156        }
     2157        if (ok) {
     2158          serializer.Serialize(original, fileName + ".proto");
     2159          // var newVersion = serializer.Deserialize(fileName + ".proto");
     2160          var p = Profile(() => original);
     2161          Console.WriteLine(p);
     2162        }
    21402163      }
    21412164    }
Note: See TracChangeset for help on using the changeset viewer.