Changeset 4770 for branches/ParameterBinding/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
- Timestamp:
- 11/11/10 14:03:24 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParameterBinding/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r4757 r4770 239 239 ParameterizeAnalyzers(); 240 240 } 241 private void MoveGenerator_InversionMoveParameter_ActualNameChanged(object sender, EventArgs e) { 242 string name = ((ILookupParameter<InversionMove>)sender).ActualName; 243 foreach (IPermutationInversionMoveOperator op in Operators.OfType<IPermutationInversionMoveOperator>()) { 244 op.InversionMoveParameter.ActualName = name; 245 } 246 } 241 247 private void MoveGenerator_TranslocationMoveParameter_ActualNameChanged(object sender, EventArgs e) { 242 248 string name = ((ILookupParameter<TranslocationMove>)sender).ActualName; … … 279 285 } 280 286 private void InitializeMoveGenerators() { 281 foreach (IPermutationInversionMoveOperator moveGen in Operators.OfType<IMoveGenerator>().OfType<IPermutationInversionMoveOperator>()) { 282 foreach (IPermutationInversionMoveOperator moveOp in Operators.Where(x => ! (x is IMoveGenerator)).OfType<IPermutationInversionMoveOperator>()) { 283 ParameterActualNameBinding binding = new ParameterActualNameBinding( 284 moveGen.InversionMoveParameter, 285 moveOp.InversionMoveParameter); 286 ParameterBindingList.Add(binding); 287 binding.Bind(); 287 foreach (IPermutationInversionMoveOperator op in Operators.OfType<IPermutationInversionMoveOperator>()) { 288 if (op is IMoveGenerator) { 289 op.InversionMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_InversionMoveParameter_ActualNameChanged); 288 290 } 289 291 } 290 foreach (IPermutationTranslocationMoveOperator moveGen in Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>()) { 291 foreach (IPermutationTranslocationMoveOperator moveOp in Operators.Where(x => !(x is IMoveGenerator)).OfType<IPermutationTranslocationMoveOperator>()) { 292 ParameterActualNameBinding binding = new ParameterActualNameBinding( 293 moveGen.TranslocationMoveParameter, 294 moveOp.TranslocationMoveParameter); 295 ParameterBindingList.Add(binding); 296 binding.Bind(); 292 foreach (IPermutationTranslocationMoveOperator op in Operators.OfType<IPermutationTranslocationMoveOperator>()) { 293 if (op is IMoveGenerator) { 294 op.TranslocationMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_TranslocationMoveParameter_ActualNameChanged); 297 295 } 298 296 } … … 312 310 } 313 311 private void ParameterizeEvaluator() { 314 ParameterSecondLevelActualNameBinding binding = new ParameterSecondLevelActualNameBinding(315 SolutionCreatorParameter, EvaluatorParameter,316 "PermutationParameter", "PermutationParameter"317 );318 ParameterBindingList.Add(binding);319 binding.Bind();320 321 312 if (Evaluator is ITSPPathEvaluator) 322 313 ((ITSPPathEvaluator)Evaluator).PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; … … 330 321 private void ParameterizeAnalyzers() { 331 322 if (BestTSPSolutionAnalyzer != null) { 323 #region Using First Level Bindings 324 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 325 BestTSPSolutionAnalyzer.QualityParameter, 326 Evaluator.QualityParameter 327 )); 328 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 329 BestTSPSolutionAnalyzer.CoordinatesParameter, 330 CoordinatesParameter 331 )); 332 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 333 BestTSPSolutionAnalyzer.PermutationParameter, 334 SolutionCreator.PermutationParameter 335 )); 336 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 337 BestTSPSolutionAnalyzer.BestKnownQualityParameter, 338 BestKnownQualityParameter 339 )); 340 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 341 BestTSPSolutionAnalyzer.BestKnownSolutionParameter, 342 BestKnownSolutionParameter 343 )); 344 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterNameBinding( 345 BestTSPSolutionAnalyzer.MaximizationParameter, 346 MaximizationParameter 347 )); 348 #endregion 349 #region Using Second Level Bindings 350 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterSecondLevelNameBinding( 351 BestTSPSolutionAnalyzer.QualityParameter, 352 EvaluatorParameter, "QualityParameter" 353 )); 354 BestTSPSolutionAnalyzer.ParameterBindingList.Add(new ParameterSecondLevelNameBinding( 355 BestTSPSolutionAnalyzer.PermutationParameter, 356 SolutionCreatorParameter, "PermutationParameter" 357 )); 358 #endregion 359 #region Old 332 360 BestTSPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 333 361 BestTSPSolutionAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name; … … 337 365 BestTSPSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 338 366 BestTSPSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 367 #endregion 339 368 } 340 369
Note: See TracChangeset
for help on using the changeset viewer.