Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13094 for trunk/sources


Ignore:
Timestamp:
10/30/15 16:26:07 (9 years ago)
Author:
pfleck
Message:

#2495
Added backwards compatibility for IslandGeneticAlgorithm and IslandOffspringSelectionGeneticAlgorithm to still use counterclockwise migration.
The UnidirectionalRingMigrator uses clockwise per default.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r12504 r13094  
    339339      ParameterizeSelectors();
    340340
    341       foreach (IMigrator migrator in ApplicationManager.Manager.GetInstances<IMigrator>().OrderBy(x => x.Name))
     341      foreach (IMigrator migrator in ApplicationManager.Manager.GetInstances<IMigrator>().OrderBy(x => x.Name)) {
     342        // BackwardsCompatibility3.3
     343        // Set the migration direction to counterclockwise
     344        var unidirectionalRing = migrator as UnidirectionalRingMigrator;
     345        if (unidirectionalRing != null) unidirectionalRing.ClockwiseMigrationDirection = new BoolValue(false);
    342346        MigratorParameter.ValidValues.Add(migrator);
     347      }
    343348
    344349      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r12504 r13094  
    405405      ParameterizeSelectors();
    406406
    407       foreach (IMigrator migrator in ApplicationManager.Manager.GetInstances<IMigrator>().OrderBy(x => x.Name))
     407      foreach (IMigrator migrator in ApplicationManager.Manager.GetInstances<IMigrator>().OrderBy(x => x.Name)) {
     408        // BackwardsCompatibility3.3
     409        // Set the migration direction to counterclockwise
     410        var unidirectionalRing = migrator as UnidirectionalRingMigrator;
     411        if (unidirectionalRing != null) unidirectionalRing.ClockwiseMigrationDirection = new BoolValue(false);
    408412        MigratorParameter.ValidValues.Add(migrator);
     413      }
    409414
    410415      foreach (IDiscreteDoubleValueModifier modifier in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/UnidirectionalRingMigrator.cs

    r13078 r13094  
    3939    }
    4040
     41    public BoolValue ClockwiseMigrationDirection
     42    {
     43      get { return ClockwiseMigrationDirectionParameter.Value; }
     44      set { ClockwiseMigrationDirectionParameter.Value = value; }
     45    }
     46
    4147    [StorableConstructor]
    4248    protected UnidirectionalRingMigrator(bool deserializing) : base(deserializing) { }
     
    4753      Parameters.Add(new ValueLookupParameter<BoolValue>("ClockwiseMigrationDirection", "True to migrate individuals clockwise, otherwise migrate individuals counterclockwise.", new BoolValue(true)));
    4854    }
    49 
    5055
    5156    [StorableHook(HookType.AfterDeserialization)]
Note: See TracChangeset for help on using the changeset viewer.