- Timestamp:
- 06/13/12 17:14:53 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r7509 r7999 227 227 ParameterizeStochasticOperator(Problem.SolutionCreator); 228 228 ParameterizeStochasticOperator(Problem.Evaluator); 229 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);229 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 230 230 ParameterizeSolutionsCreator(); 231 231 ParameterizeGeneticAlgorithmMainLoop(); -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs
r7524 r7999 326 326 ParameterizeStochasticOperator(Problem.SolutionCreator); 327 327 ParameterizeStochasticOperator(Problem.Evaluator); 328 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);328 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 329 329 ParameterizeSolutionsCreator(); 330 330 ParameterizeMainLoop(); … … 354 354 } 355 355 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 356 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);356 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 357 357 ParameterizeIterationBasedOperators(); 358 358 UpdateCrossovers(); -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs
r7510 r7999 203 203 ParameterizeStochasticOperator(Problem.SolutionCreator); 204 204 ParameterizeStochasticOperator(Problem.Evaluator); 205 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);205 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 206 206 foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) { 207 207 op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged); -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchImprovementOperator.cs
r7259 r7999 292 292 if (MoveGenerator != null && Problem != null) { 293 293 IMoveGenerator generator = MoveGeneratorParameter.Value; 294 foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators ).OrderBy(x => x.Name))294 foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name)) 295 295 MoveMakerParameter.ValidValues.Add(moveMaker); 296 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators ).OrderBy(x => x.Name))296 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name)) 297 297 MoveEvaluatorParameter.ValidValues.Add(moveEvaluator); 298 298 -
trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs
r7511 r7999 244 244 ParameterizeStochasticOperator(Problem.SolutionCreator); 245 245 ParameterizeStochasticOperator(Problem.Evaluator); 246 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);246 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 247 247 ParameterizeSolutionsCreator(); 248 248 ParameterizeRankAndCrowdingSorter(); … … 273 273 } 274 274 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 275 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);275 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 276 276 ParameterizeIterationBasedOperators(); 277 277 UpdateCrossovers(); -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r7511 r7999 408 408 ParameterizeStochasticOperator(Problem.SolutionCreator); 409 409 ParameterizeStochasticOperator(Problem.Evaluator); 410 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);410 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 411 411 ParameterizeSolutionsCreator(); 412 412 ParameterizeMainLoop(); … … 436 436 } 437 437 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 438 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);438 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 439 439 ParameterizeIterationBasedOperators(); 440 440 UpdateCrossovers(); -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs
r7609 r7999 316 316 ParameterizeStochasticOperator(Problem.SolutionCreator); 317 317 ParameterizeStochasticOperator(Problem.Evaluator); 318 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);318 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 319 319 ParameterizeSolutionsCreator(); 320 320 ParameterizMainLoop(); … … 344 344 } 345 345 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 346 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);346 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 347 347 ParameterizeIterationBasedOperators(); 348 348 UpdateCrossovers(); -
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs
r7259 r7999 367 367 ParameterizeStochasticOperator(Problem.SolutionCreator); 368 368 ParameterizeStochasticOperator(Problem.Evaluator); 369 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);369 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 370 370 ParameterizeSolutionsCreator(); 371 371 ParameterizeMainLoop(); … … 395 395 } 396 396 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 397 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);397 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 398 398 ParameterizeIterationBasedOperators(); 399 399 UpdateCrossovers(); -
trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r7517 r7999 233 233 ParameterizeStochasticOperator(Problem.SolutionCreator); 234 234 ParameterizeStochasticOperator(Problem.Evaluator); 235 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);235 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 236 236 foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) { 237 237 op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged); … … 266 266 } 267 267 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 268 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);268 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 269 269 // This may seem pointless, but some operators already have the eventhandler registered, others don't 270 270 // FIXME: Is there another way to solve this problem? -
trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingImprovementOperator.cs
r7259 r7999 316 316 if (MoveGenerator != null) { 317 317 IMoveGenerator generator = MoveGeneratorParameter.Value; 318 foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators ).OrderBy(x => x.Name))318 foreach (IMoveMaker moveMaker in MoveHelper.GetCompatibleMoveMakers(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name)) 319 319 MoveMakerParameter.ValidValues.Add(moveMaker); 320 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators ).OrderBy(x => x.Name))320 foreach (ISingleObjectiveMoveEvaluator moveEvaluator in MoveHelper.GetCompatibleSingleObjectiveMoveEvaluators(generator, Problem.Operators.OfType<IOperator>()).OrderBy(x => x.Name)) 321 321 MoveEvaluatorParameter.ValidValues.Add(moveEvaluator); 322 322 -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r7516 r7999 230 230 ParameterizeStochasticOperator(Problem.SolutionCreator); 231 231 ParameterizeStochasticOperator(Problem.Evaluator); 232 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);232 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 233 233 foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) { 234 234 op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged); … … 270 270 } 271 271 protected override void Problem_OperatorsChanged(object sender, EventArgs e) { 272 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);272 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 273 273 // This may seem pointless, but some operators already have the eventhandler registered, others don't 274 274 // FIXME: Is there another way to solve this problem? -
trunk/sources/HeuristicLab.Algorithms.VariableNeighborhoodSearch/3.3/VariableNeighborhoodSearch.cs
r7518 r7999 212 212 ParameterizeStochasticOperator(Problem.SolutionCreator); 213 213 ParameterizeStochasticOperator(Problem.Evaluator); 214 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);214 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 215 215 ParameterizeSolutionsCreator(); 216 216 ParameterizeMainLoop(); … … 237 237 UpdateShakingOperators(); 238 238 UpdateAnalyzers(); 239 foreach (IOperator op in Problem.Operators ) ParameterizeStochasticOperator(op);239 foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op); 240 240 ParameterizeIterationBasedOperators(); 241 241 base.Problem_OperatorsChanged(sender, e); -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs
r7259 r7999 29 29 /// </summary> 30 30 public interface IProblem : IParameterizedNamedItem { 31 IEnumerable<I Operator> Operators { get; }31 IEnumerable<IItem> Operators { get; } 32 32 33 33 event EventHandler OperatorsChanged; -
trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r7706 r7999 35 35 public abstract class Problem : ParameterizedNamedItem, IProblem { 36 36 private static readonly string OperatorsParameterName = "Operators"; 37 38 public IFixedValueParameter<OperatorCollection> OperatorsParameter { 39 get { return (IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]; } 37 public IFixedValueParameter<ItemCollection<IItem>> OperatorsParameter { 38 get { return (IFixedValueParameter<ItemCollection<IItem>>)Parameters[OperatorsParameterName]; } 40 39 } 41 40 … … 53 52 protected Problem() 54 53 : base() { 55 Parameters.Add(new FixedValueParameter< OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));54 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false)); 56 55 OperatorsParameter.Hidden = true; 57 56 RegisterEventHandlers(); … … 60 59 [StorableHook(HookType.AfterDeserialization)] 61 60 private void AfterDeserialization() { 61 // BackwardsCompatibility3.3 62 #region Backwards compatible code, remove with 3.4 63 if (Parameters.ContainsKey(OperatorsParameterName) && Parameters[OperatorsParameterName] is FixedValueParameter<OperatorCollection>) { 64 OperatorCollection tmp = ((IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]).Value; 65 Parameters.Remove(OperatorsParameterName); 66 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(tmp), false)); 67 OperatorsParameter.Hidden = true; 68 } 69 #endregion 70 62 71 RegisterEventHandlers(); 63 72 } 64 73 65 74 private void RegisterEventHandlers() { 66 Operators.ItemsAdded += new CollectionItemsChangedEventHandler<I Operator>(Operators_Changed);67 Operators.ItemsRemoved += new CollectionItemsChangedEventHandler<I Operator>(Operators_Changed);68 Operators.CollectionReset += new CollectionItemsChangedEventHandler<I Operator>(Operators_Changed);75 Operators.ItemsAdded += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed); 76 Operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed); 77 Operators.CollectionReset += new CollectionItemsChangedEventHandler<IItem>(Operators_Changed); 69 78 } 70 79 … … 72 81 // BackwardsCompatibility3.3 73 82 #region Backwards compatible code, remove with 3.4 74 [Storable(Name = "Operators" )]83 [Storable(Name = "Operators", AllowOneWay = true)] 75 84 private IEnumerable<IOperator> StorableOperators { 76 get { return null; }77 85 set { 78 86 if (!Parameters.ContainsKey(OperatorsParameterName)) { 79 Parameters.Add(new FixedValueParameter< OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(value), false));87 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(value), false)); 80 88 OperatorsParameter.Hidden = true; 81 89 } … … 83 91 } 84 92 #endregion 85 protected OperatorCollectionOperators {93 protected ItemCollection<IItem> Operators { 86 94 get { 87 95 // BackwardsCompatibility3.3 88 96 #region Backwards compatible code, remove with 3.4 89 97 if (!Parameters.ContainsKey(OperatorsParameterName)) { 90 Parameters.Add(new FixedValueParameter< OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", new OperatorCollection(), false));98 Parameters.Add(new FixedValueParameter<ItemCollection<IItem>>(OperatorsParameterName, "The operators and items that the problem provides to the algorithms.", new ItemCollection<IItem>(), false)); 91 99 OperatorsParameter.Hidden = true; 92 100 } … … 95 103 } 96 104 } 97 IEnumerable<I Operator> IProblem.Operators { get { return Operators; } }105 IEnumerable<IItem> IProblem.Operators { get { return Operators; } } 98 106 #endregion 99 107 -
trunk/sources/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r7351 r7999 81 81 get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; } 82 82 } 83 public ValueParameter<ItemList<I Operator>> OperatorsParameter {84 get { return (ValueParameter<ItemList<I Operator>>)Parameters["Operators"]; }83 public ValueParameter<ItemList<IItem>> OperatorsParameter { 84 get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; } 85 85 } 86 86 #endregion … … 112 112 set { BestKnownQualityParameter.Value = value; } 113 113 } 114 public IEnumerable<I Operator> Operators {114 public IEnumerable<IItem> Operators { 115 115 get { return OperatorsParameter.Value; } 116 116 } … … 121 121 [StorableHook(HookType.AfterDeserialization)] 122 122 private void AfterDeserialization() { 123 // BackwardsCompatibility3.3 124 #region Backwards compatible code, remove with 3.4 125 if (Parameters.ContainsKey("Operators") && Parameters["Operators"] is ValueParameter<ItemList<IOperator>>) { 126 ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value; 127 Parameters.Remove("Operators"); 128 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false)); 129 } 130 #endregion 131 123 132 RegisterEventHandlers(); 124 133 } … … 130 139 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.")); 131 140 Parameters.Add(new OptionalValueParameter<IScope>("BestKnownSolution", "The best known solution for this external evaluation problem.")); 132 Parameters.Add(new ValueParameter<ItemList<I Operator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>()));141 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>())); 133 142 134 143 RegisterEventHandlers(); … … 200 209 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 201 210 OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged); 202 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_ItemsAdded);203 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_ItemsRemoved);204 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_CollectionReset);211 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsAdded); 212 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsRemoved); 213 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_CollectionReset); 205 214 } 206 215 … … 209 218 if (Evaluator != null) { 210 219 string qualityName = Evaluator.QualityParameter.ActualName; 211 foreach (IOperator op in OperatorsParameter.Value ) {220 foreach (IOperator op in OperatorsParameter.Value.OfType<IOperator>()) { 212 221 foreach (ILookupParameter<DoubleValue> param in op.Parameters.OfType<ILookupParameter<DoubleValue>>()) { 213 222 if (param.Name.Equals("Quality")) param.ActualName = qualityName; -
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs
r7351 r7999 83 83 get { return (OptionalValueParameter<IScope>)Parameters["BestKnownSolution"]; } 84 84 } 85 public ValueParameter<ItemList<I Operator>> OperatorsParameter {86 get { return (ValueParameter<ItemList<I Operator>>)Parameters["Operators"]; }85 public ValueParameter<ItemList<IItem>> OperatorsParameter { 86 get { return (ValueParameter<ItemList<IItem>>)Parameters["Operators"]; } 87 87 } 88 88 public OptionalValueParameter<EvaluationCache> CacheParameter { … … 117 117 set { BestKnownQualityParameter.Value = value; } 118 118 } 119 public IEnumerable<I Operator> Operators {119 public IEnumerable<IItem> Operators { 120 120 get { return OperatorsParameter.Value; } 121 121 } … … 145 145 Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this problem.")); 146 146 Parameters.Add(new OptionalValueParameter<IScope>("BestKnownSolution", "The best known solution for this external evaluation problem.")); 147 Parameters.Add(new ValueParameter<ItemList<I Operator>>("Operators", "The operators that are passed to the algorithm.", new ItemList<IOperator>()));147 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>())); 148 148 Parameters.Add(new OptionalValueParameter<EvaluationCache>("Cache", "Cache of previously evaluated solutions.")); 149 149 … … 164 164 } 165 165 } 166 167 if (Parameters.ContainsKey("Operators") && Parameters["Operators"] is ValueParameter<ItemList<IOperator>>) { 168 ItemList<IOperator> tmp = ((ValueParameter<ItemList<IOperator>>)Parameters["Operators"]).Value; 169 Parameters.Remove("Operators"); 170 Parameters.Add(new ValueParameter<ItemList<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.", new ItemList<IItem>(tmp), false)); 171 } 166 172 #endregion 167 173 RegisterEventHandlers(); … … 221 227 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 222 228 OperatorsParameter.ValueChanged += new EventHandler(OperatorsParameter_ValueChanged); 223 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_ItemsAdded);224 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_ItemsRemoved);225 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<I Operator>>(OperatorsParameter_Value_CollectionReset);229 OperatorsParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsAdded); 230 OperatorsParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_ItemsRemoved); 231 OperatorsParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IItem>>(OperatorsParameter_Value_CollectionReset); 226 232 } 227 233 private void InitializeOperators() { 228 ItemList<I Operator> operators = OperatorsParameter.Value;234 ItemList<IItem> operators = OperatorsParameter.Value; 229 235 operators.Add(new BestScopeSolutionAnalyzer()); 230 236 ParameterizeAnalyzers(); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
r7934 r7999 110 110 111 111 [Storable] 112 private List<I Operator> operators;113 114 public IEnumerable<I Operator> Operators {112 private List<IItem> operators; 113 114 public IEnumerable<IItem> Operators { 115 115 get { return operators; } 116 116 } … … 131 131 EvaluatorParameter.Hidden = true; 132 132 133 operators = new List<I Operator>();133 operators = new List<IItem>(); 134 134 135 135 InitializeRandomVRPInstance(); … … 147 147 private VehicleRoutingProblem(VehicleRoutingProblem original, Cloner cloner) 148 148 : base(original, cloner) { 149 this.operators = original.operators.Select(x => (I Operator)cloner.Clone(x)).ToList();149 this.operators = original.operators.Select(x => (IItem)cloner.Clone(x)).ToList(); 150 150 this.AttachEventHandlers(); 151 151 } … … 254 254 255 255 private void InitializeOperators() { 256 operators = new List<I Operator>();256 operators = new List<IItem>(); 257 257 258 258 if (ProblemInstance != null) { … … 267 267 private void ParameterizeSolutionCreator() { 268 268 if (SolutionCreator is IMultiVRPOperator) { 269 (SolutionCreator as IMultiVRPOperator).SetOperators(Operators );269 (SolutionCreator as IMultiVRPOperator).SetOperators(Operators.OfType<IOperator>()); 270 270 } 271 271 } 272 272 273 273 private void ParameterizeOperators() { 274 foreach (IOperator op in Operators ) {274 foreach (IOperator op in Operators.OfType<IOperator>()) { 275 275 if (op is IMultiVRPOperator) { 276 (op as IMultiVRPOperator).SetOperators(Operators );276 (op as IMultiVRPOperator).SetOperators(Operators.OfType<IOperator>()); 277 277 } 278 278 }
Note: See TracChangeset
for help on using the changeset viewer.