Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/10 04:56:06 (15 years ago)
Author:
swagner
Message:

Continued to implement TSP tour visualization (#924)

Location:
trunk/sources/HeuristicLab.Algorithms.SGA/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs

    r3095 r3107  
    183183      ParameterizeStochasticOperator(Problem.SolutionCreator);
    184184      ParameterizeStochasticOperator(Problem.Evaluator);
     185      ParameterizeStochasticOperator(Problem.Visualizer);
    185186      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
    186187      ParameterizeSolutionsCreator();
     
    204205      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    205206      base.Problem_EvaluatorChanged(sender, e);
     207    }
     208    protected override void Problem_VisualizerChanged(object sender, EventArgs e) {
     209      ParameterizeStochasticOperator(Problem.Visualizer);
     210      ParameterizeSGAMainLoop();
     211      base.Problem_VisualizerChanged(sender, e);
    206212    }
    207213    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
     
    253259      SGAMainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
    254260      SGAMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     261      SGAMainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;
     262      SGAMainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;
    255263    }
    256264    private void ParameterizeStochasticOperator(IOperator op) {
  • trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGAMainLoop.cs

    r3096 r3107  
    7474      get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
    7575    }
     76    public ValueLookupParameter<IOperator> VisualizerParameter {
     77      get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; }
     78    }
     79    public LookupParameter<IItem> VisualizationParameter {
     80      get { return (LookupParameter<IItem>)Parameters["Visualization"]; }
     81    }
    7682    private ScopeParameter CurrentScopeParameter {
    7783      get { return (ScopeParameter)Parameters["CurrentScope"]; }
     
    104110      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    105111      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     112      Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
     113      Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
    106114      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the SGA should be applied."));
    107115      #endregion
     
    114122      DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector();
    115123      QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
     124      Placeholder visualizer1 = new Placeholder();
    116125      ResultsCollector resultsCollector = new ResultsCollector();
    117126      Placeholder selector = new Placeholder();
     
    135144      DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector();
    136145      QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
     146      Placeholder visualizer2 = new Placeholder();
    137147      ConditionalBranch conditionalBranch = new ConditionalBranch();
    138148
     
    164174      qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
    165175      qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
     176
     177      visualizer1.Name = "Visualizer";
     178      visualizer1.OperatorParameter.ActualName = "Visualizer";
    166179
    167180      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     
    173186      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
    174187      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
     188      resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, "Visualization"));
    175189      resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities"));
    176190      resultsCollector.ResultsParameter.ActualName = "Results";
     
    233247      qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
    234248      qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
     249
     250      visualizer2.Name = "Visualizer";
     251      visualizer2.OperatorParameter.ActualName = "Visualizer";
    235252
    236253      conditionalBranch.ConditionParameter.ActualName = "Terminate";
     
    244261      bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1;
    245262      dataTableValuesCollector1.Successor = qualityDifferenceCalculator1;
    246       qualityDifferenceCalculator1.Successor = resultsCollector;
     263      qualityDifferenceCalculator1.Successor = visualizer1;
     264      visualizer1.Successor = resultsCollector;
    247265      resultsCollector.Successor = selector;
    248266      selector.Successor = sequentialSubScopesProcessor1;
     
    272290      bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector2;
    273291      dataTableValuesCollector2.Successor = qualityDifferenceCalculator2;
    274       qualityDifferenceCalculator2.Successor = conditionalBranch;
     292      qualityDifferenceCalculator2.Successor = visualizer2;
     293      visualizer2.Successor = conditionalBranch;
    275294      conditionalBranch.FalseBranch = selector;
    276295      conditionalBranch.TrueBranch = null;
Note: See TracChangeset for help on using the changeset viewer.