Changeset 15504 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/MultiGQAPCrossover.cs
- Timestamp:
- 12/10/17 22:11:10 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/MultiGQAPCrossover.cs
r11505 r15504 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 35 35 [Item("MultiGQAPCrossover", "Randomly selects and applies one of its crossovers every time it is called.")] 36 36 [StorableClass] 37 public class MultiGQAPCrossover : StochasticMultiBranch<IGQAPCrossover>, IGQAPCrossover {37 public class MultiGQAPCrossover : StochasticMultiBranch<IGQAPCrossover>, IGQAPCrossover, IProblemInstanceAwareGQAPOperator, IStochasticOperator { 38 38 public override bool CanChangeName { 39 39 get { return false; } … … 49 49 get { return (ILookupParameter<IntegerVector>)Parameters["Child"]; } 50 50 } 51 public ILookupParameter<GQAPInstance> ProblemInstanceParameter { 52 get { return (ILookupParameter<GQAPInstance>)Parameters["ProblemInstance"]; } 53 } 51 54 52 55 [StorableConstructor] … … 57 60 Parameters.Add(new ScopeTreeLookupParameter<IntegerVector>("Parents", "The parent vectors which should be crossed.", "Assignment")); 58 61 Parameters.Add(new LookupParameter<IntegerVector>("Child", "The child vector resulting from the crossover.", "Assignment")); 62 Parameters.Add(new LookupParameter<GQAPInstance>("ProblemInstance", GQAP.ProblemInstanceDescription)); 63 59 64 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IGQAPCrossover))) { 60 65 if (!typeof(MultiOperator<IGQAPCrossover>).IsAssignableFrom(type)) … … 79 84 foreach (var op in Operators.OfType<IGQAPCrossover>()) { 80 85 op.ParentsParameter.ActualName = ParentsParameter.Name; 86 op.ParentsParameter.Hidden = true; 81 87 op.ChildParameter.ActualName = ChildParameter.Name; 88 op.ChildParameter.Hidden = true; 82 89 } 83 90 foreach (var op in Operators.OfType<IStochasticOperator>()) { 84 91 op.RandomParameter.ActualName = RandomParameter.Name; 92 op.RandomParameter.Hidden = true; 93 } 94 foreach (var op in Operators.OfType<IProblemInstanceAwareGQAPOperator>()) { 95 op.ProblemInstanceParameter.ActualName = ProblemInstanceParameter.Name; 96 op.ProblemInstanceParameter.Hidden = true; 85 97 } 86 98 } … … 88 100 public override IOperation InstrumentedApply() { 89 101 if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one crossover to choose from."); 90 return base. Apply();102 return base.InstrumentedApply(); 91 103 } 92 104 }
Note: See TracChangeset
for help on using the changeset viewer.