Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/01/18 23:52:39 (6 years ago)
Author:
abeham
Message:

#1614:

  • Fixed some bugs
  • Added OSGA
  • Updated ES (added recombination)
  • Reusing operators among algorihtms (RelocateEquipmentManipluator)
  • Rewrote DiscreteLocationCrossover
File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Evolutionary/OSGAContext.cs

    r15562 r15564  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Data;
    2526using HeuristicLab.Parameters;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
    28 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.GRASP {
    29   [Item("GRASP+PR (GQAP) Context", "Context for GRASP+PR (GQAP).")]
     29namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.Evolutionary {
     30  [Item("OSGA (GQAP) Context", "Context for OSGA (GQAP).")]
    3031  [StorableClass]
    31   public sealed class GRASPContext : SingleObjectivePopulationContext<ISingleObjectiveSolutionScope<GQAPSolution>> {
     32  public sealed class OSGAContext : SingleObjectivePopulationContext<ISingleObjectiveSolutionScope<GQAPSolution>> {
    3233   
    3334    [Storable]
     
    4445      set { bestSolution.Value = value; }
    4546    }
    46    
     47
     48    [Storable]
     49    private IValueParameter<ItemList<ISingleObjectiveSolutionScope<GQAPSolution>>> nextGeneration;
     50    public ItemList<ISingleObjectiveSolutionScope<GQAPSolution>> NextGeneration {
     51      get { return nextGeneration.Value; }
     52      set { nextGeneration.Value = value; }
     53    }
     54
     55    [Storable]
     56    private IValueParameter<DoubleValue> selectionPressure;
     57    public double SelectionPressure {
     58      get { return selectionPressure.Value.Value; }
     59      set { selectionPressure.Value.Value = value; }
     60    }
     61
     62    [Storable]
     63    private IValueParameter<IntValue> attempts;
     64    public int Attempts {
     65      get { return attempts.Value.Value; }
     66      set { attempts.Value.Value = value; }
     67    }
     68
    4769    public void SortPopulation() {
    4870      Scope.SubScopes.Replace(Scope.SubScopes.OfType<ISingleObjectiveSolutionScope<GQAPSolution>>().OrderBy(x => Problem.Maximization ? -x.Fitness : x.Fitness).ToList());
     
    5072   
    5173    [StorableConstructor]
    52     private GRASPContext(bool deserializing) : base(deserializing) { }
    53     private GRASPContext(GRASPContext original, Cloner cloner)
     74    private OSGAContext(bool deserializing) : base(deserializing) { }
     75    private OSGAContext(OSGAContext original, Cloner cloner)
    5476      : base(original, cloner) {
    5577      problem = cloner.Clone(original.problem);
    5678      bestSolution = cloner.Clone(original.bestSolution);
     79      nextGeneration = cloner.Clone(original.nextGeneration);
     80      selectionPressure = cloner.Clone(original.selectionPressure);
     81      attempts = cloner.Clone(original.attempts);
    5782    }
    58     public GRASPContext() : this("GRASP+PR (GQAP) Context") { }
    59     public GRASPContext(string name) : base(name) {
     83    public OSGAContext() : this("OSGA (GQAP) Context") { }
     84    public OSGAContext(string name) : base(name) {
    6085      Parameters.Add(problem = new ValueParameter<GQAP>("Problem"));
    6186      Parameters.Add(bestSolution = new ValueParameter<GQAPSolution>("BestFoundSolution"));
     87      Parameters.Add(nextGeneration = new ValueParameter<ItemList<ISingleObjectiveSolutionScope<GQAPSolution>>>("NextGeneration"));
     88      Parameters.Add(selectionPressure = new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0)));
     89      Parameters.Add(attempts = new ValueParameter<IntValue>("Attempts", new IntValue(0)));
    6290    }
    6391
    6492    public override IDeepCloneable Clone(Cloner cloner) {
    65       return new GRASPContext(this, cloner);
     93      return new OSGAContext(this, cloner);
    6694    }
    6795
Note: See TracChangeset for help on using the changeset viewer.