- Timestamp:
- 04/27/11 09:22:20 (14 years ago)
- Location:
- branches/histogram
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/histogram
- Property svn:mergeinfo changed
/trunk/sources merged: 6047-6048,6051-6054
- Property svn:mergeinfo changed
-
branches/histogram/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs
r5809 r6055 330 330 if (Problem != null) { 331 331 qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 332 qualityAnalyzer.MaximizationParameter.Hidden = true; 332 333 qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 333 334 qualityAnalyzer.QualityParameter.Depth = 0; 335 qualityAnalyzer.QualityParameter.Hidden = true; 334 336 qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 337 qualityAnalyzer.BestKnownQualityParameter.Hidden = true; 338 } else { 339 qualityAnalyzer.MaximizationParameter.Hidden = false; 340 qualityAnalyzer.QualityParameter.Hidden = false; 341 qualityAnalyzer.BestKnownQualityParameter.Hidden = false; 335 342 } 336 343 } … … 371 378 } 372 379 private void ParameterizeMainLoop() { 373 MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 374 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 375 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 380 if (Problem != null) { 381 MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 382 MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 383 MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 384 } 376 385 if (MoveEvaluator != null) 377 386 MainLoop.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 378 387 } 379 388 private void ParameterizeStochasticOperator(IOperator op) { 380 if (op is IStochasticOperator) 381 ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 389 if (op is IStochasticOperator) { 390 IStochasticOperator stOp = (IStochasticOperator)op; 391 stOp.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 392 stOp.RandomParameter.Hidden = true; 393 } 382 394 } 383 395 private void ParameterizeMoveEvaluators() { 384 396 foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) { 385 397 op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 398 op.QualityParameter.Hidden = true; 386 399 } 387 400 } … … 389 402 foreach (IMoveMaker op in Problem.Operators.OfType<IMoveMaker>()) { 390 403 op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 391 if (MoveEvaluator != null) 404 op.QualityParameter.Hidden = true; 405 if (MoveEvaluator != null) { 392 406 op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 407 op.MoveQualityParameter.Hidden = true; 408 } else { 409 op.MoveQualityParameter.Hidden = false; 410 } 393 411 } 394 412 } … … 396 414 foreach (IDiscreteDoubleValueModifier op in AnnealingOperatorParameter.ValidValues) { 397 415 op.IndexParameter.ActualName = "Iterations"; 416 op.IndexParameter.Hidden = true; 398 417 op.StartIndexParameter.Value = new IntValue(0); 399 418 op.EndIndexParameter.ActualName = MaximumIterationsParameter.Name; 400 419 op.ValueParameter.ActualName = "Temperature"; 420 op.ValueParameter.Hidden = true; 401 421 op.StartValueParameter.ActualName = StartTemperatureParameter.Name; 422 op.StartValueParameter.Hidden = true; 402 423 op.EndValueParameter.ActualName = EndTemperatureParameter.Name; 424 op.EndValueParameter.Hidden = true; 403 425 ParameterizeStochasticOperator(op); 404 426 } … … 407 429 foreach (IMultiMoveGenerator op in Problem.Operators.OfType<IMultiMoveGenerator>()) { 408 430 op.SampleSizeParameter.ActualName = InnerIterationsParameter.Name; 431 op.SampleSizeParameter.Hidden = true; 409 432 } 410 433 } … … 413 436 foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) { 414 437 op.IterationsParameter.ActualName = "Iterations"; 438 op.IterationsParameter.Hidden = true; 415 439 op.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; 440 op.MaximumIterationsParameter.Hidden = true; 416 441 } 417 442 } -
branches/histogram/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingImprovementOperator.cs
r6046 r6055 259 259 } 260 260 261 private bool IsSubclassOfGeneric(Type generic, Type toCheck) { 262 while (toCheck != typeof(object)) { 263 var cur = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck; 264 if (generic == cur) { 265 return true; 266 } 267 toCheck = toCheck.BaseType; 268 } 269 return false; 270 } 271 261 272 private void UpdateAnalyzers() { 262 273 Analyzer.Operators.Clear(); 263 274 if (problem != null) { 264 275 foreach (IAnalyzer analyzer in problem.Operators.OfType<IAnalyzer>()) { 265 IAnalyzer clone = analyzer.Clone() as IAnalyzer; 266 foreach (IScopeTreeLookupParameter param in clone.Parameters.OfType<IScopeTreeLookupParameter>()) 267 param.Depth = 0; 268 Analyzer.Operators.Add(clone); 276 if (!IsSubclassOfGeneric(typeof(AlleleFrequencyAnalyzer<>), analyzer.GetType()) && 277 !IsSubclassOfGeneric(typeof(PopulationDiversityAnalyzer<>), analyzer.GetType())) { 278 IAnalyzer clone = analyzer.Clone() as IAnalyzer; 279 foreach (IScopeTreeLookupParameter param in clone.Parameters.OfType<IScopeTreeLookupParameter>()) 280 param.Depth = 0; 281 Analyzer.Operators.Add(clone); 282 } 269 283 } 270 284 }
Note: See TracChangeset
for help on using the changeset viewer.