Changeset 15504 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Manipulators/MultiGQAPManipulator.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/Manipulators/MultiGQAPManipulator.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("MultiGQAPManipulator", "Randomly selects and applies one of its manipulators every time it is called.")] 36 36 [StorableClass] 37 public class MultiGQAPManipulator : StochasticMultiBranch<IGQAPManipulator>, IGQAPManipulator { 37 public class MultiGQAPManipulator : StochasticMultiBranch<IGQAPManipulator>, IGQAPManipulator, 38 IProblemInstanceAwareGQAPOperator { 38 39 public override bool CanChangeName { 39 40 get { return false; } … … 46 47 get { return (ILookupParameter<IntegerVector>)Parameters["Assignment"]; } 47 48 } 49 public ILookupParameter<GQAPInstance> ProblemInstanceParameter { 50 get { return (ILookupParameter<GQAPInstance>)Parameters["ProblemInstance"]; } 51 } 48 52 49 53 [StorableConstructor] … … 53 57 : base() { 54 58 Parameters.Add(new LookupParameter<IntegerVector>("Assignment", GQAPSolutionCreator.AssignmentDescription)); 59 Parameters.Add(new LookupParameter<GQAPInstance>("ProblemInstance", GQAP.ProblemInstanceDescription)); 60 55 61 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IGQAPManipulator))) { 56 62 if (!typeof(MultiOperator<IGQAPManipulator>).IsAssignableFrom(type)) … … 73 79 74 80 private void Parameterize() { 75 foreach (var op in Operators.OfType<IGQAPManipulator>()) 81 foreach (var op in Operators.OfType<IGQAPManipulator>()) { 76 82 op.AssignmentParameter.ActualName = AssignmentParameter.Name; 77 foreach (var op in Operators.OfType<IStochasticOperator>()) 83 op.AssignmentParameter.Hidden = true; 84 } 85 foreach (var op in Operators.OfType<IStochasticOperator>()) { 78 86 op.RandomParameter.ActualName = RandomParameter.Name; 87 op.RandomParameter.Hidden = true; 88 } 89 foreach (var op in Operators.OfType<IProblemInstanceAwareGQAPOperator>()) { 90 op.ProblemInstanceParameter.ActualName = ProblemInstanceParameter.Name; 91 op.ProblemInstanceParameter.Hidden = true; 92 } 79 93 } 80 94 81 95 public override IOperation InstrumentedApply() { 82 96 if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one manipulator to choose from."); 83 return base. Apply();97 return base.InstrumentedApply(); 84 98 } 85 99 }
Note: See TracChangeset
for help on using the changeset viewer.