Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/21/21 15:31:20 (4 years ago)
Author:
abeham
Message:

#2521: updated samples (except for GPR - unit test needs to be refactored first)

  • Fixed a few bugs in VRP
  • Fixed the GAGroupingProblemSampleTest
Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs

    r17718 r17954  
    6464      var assembly = typeof(IAlbaOperator).Assembly;
    6565      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
     66      discoveredTypes = discoveredTypes.Where(x => EncodingOperatorTypes.Except(new[] { typeof(IAlbaOperator) }).All(y => !y.IsAssignableFrom(x)));
    6667      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
    6768      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/GVREncoding.cs

    r17718 r17954  
    6464      var assembly = typeof(IGVROperator).Assembly;
    6565      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
     66      discoveredTypes = discoveredTypes.Where(x => EncodingOperatorTypes.Except(new[] { typeof(IGVROperator) }).All(y => !y.IsAssignableFrom(x)));
    6667      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
    6768      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/IPotvinOperator.cs

    r17717 r17954  
    2121
    2222using HEAL.Attic;
     23using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2324
    2425namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    2526  [StorableType("90265685-321B-4E34-AD9F-30FA917F07A0")]
    26   public interface IPotvinOperator /*:
    27     ISingleDepotOperator, IHomogenousCapacitatedOperator, ITimeWindowedOperator,
    28     IMultiDepotOperator, IHeterogenousCapacitatedOperator*/ {
     27  public interface IPotvinOperator : IGeneralVRPOperator {
    2928  }
    3029}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs

    r17718 r17954  
    6464      var assembly = typeof(IPotvinOperator).Assembly;
    6565      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
     66      discoveredTypes = discoveredTypes.Where(x => EncodingOperatorTypes.Except(new[] { typeof(IPotvinOperator) }).All(y => !y.IsAssignableFrom(x)));
    6667      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
    6768      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/PrinsEncoding.cs

    r17718 r17954  
    6464      var assembly = typeof(IPrinsOperator).Assembly;
    6565      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
     66      discoveredTypes = discoveredTypes.Where(x => EncodingOperatorTypes.Except(new[] { typeof(IPrinsOperator) }).All(y => !y.IsAssignableFrom(x)));
    6667      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
    6768      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/VRPEncoding.cs

    r17718 r17954  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Linq;
    2325using HEAL.Attic;
     
    3133  [StorableType("2bb0d7d5-d842-4cf7-8242-1d49940aa4b6")]
    3234  public abstract class VRPEncoding : Encoding, IVRPEncoding {
     35    private static HashSet<Type> encodingOperatorTypes = new HashSet<Type>() { typeof(Alba.IAlbaOperator), typeof(GVR.IGVROperator),
     36      typeof(Potvin.IPotvinOperator), typeof(Prins.IPrinsOperator), typeof(Zhu.IZhuOperator) };
     37    public static IReadOnlyCollection<Type> EncodingOperatorTypes => encodingOperatorTypes.ToList().AsReadOnly();
    3338
    3439    [StorableConstructor]
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/ZhuEncoding.cs

    r17718 r17954  
    6464      var assembly = typeof(IZhuOperator).Assembly;
    6565      var discoveredTypes = ApplicationManager.Manager.GetTypes(encodingSpecificOperatorTypes, assembly, true, false, false);
     66      discoveredTypes = discoveredTypes.Where(x => EncodingOperatorTypes.Except(new[] { typeof(IZhuOperator) }).All(y => !y.IsAssignableFrom(x)));
    6667      var operators = discoveredTypes.Select(t => (IOperator)Activator.CreateInstance(t));
    6768      var newOperators = operators.Except(Operators, new TypeEqualityComparer<IOperator>()).ToList();
Note: See TracChangeset for help on using the changeset viewer.