Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/06/10 02:46:37 (14 years ago)
Author:
swagner
Message:

Worked on refactoring of algorithm analysis and tracing (#999)

  • adapted analyzers
Location:
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3
Files:
3 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/PopulationBestTSPSolutionAnalyzer.cs

    r3659 r3662  
    3636  [Item("PopulationBestTSPSolutionAnalyzer", "An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates.")]
    3737  [StorableClass]
    38   public sealed class PopulationBestTSPSolutionAnalyzer : SingleSuccessorOperator, IBestTSPSolutionAnalyzer, IAnalyzer {
    39     public ILookupParameter<DoubleMatrix> CoordinatesParameter {
    40       get { return (ILookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
     38  public sealed class PopulationBestTSPSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer {
     39    public LookupParameter<DoubleMatrix> CoordinatesParameter {
     40      get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
    4141    }
    42     public ILookupParameter<ItemArray<Permutation>> PermutationParameter {
    43       get { return (ILookupParameter<ItemArray<Permutation>>)Parameters["Permutation"]; }
     42    public ScopeTreeLookupParameter<Permutation> PermutationParameter {
     43      get { return (ScopeTreeLookupParameter<Permutation>)Parameters["Permutation"]; }
    4444    }
    45     ILookupParameter IBestTSPSolutionAnalyzer.PermutationParameter {
    46       get { return PermutationParameter; }
     45    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     46      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    4747    }
    48     public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {
    49       get { return (ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }
     48    public LookupParameter<PathTSPTour> BestSolutionParameter {
     49      get { return (LookupParameter<PathTSPTour>)Parameters["BestSolution"]; }
    5050    }
    51     ILookupParameter IBestTSPSolutionAnalyzer.QualityParameter {
    52       get { return QualityParameter; }
    53     }
    54     public ILookupParameter<PathTSPTour> BestSolutionParameter {
    55       get { return (ILookupParameter<PathTSPTour>)Parameters["BestSolution"]; }
    56     }
    57     public IValueLookupParameter<ResultCollection> ResultsParameter {
    58       get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     51    public ValueLookupParameter<ResultCollection> ResultsParameter {
     52      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    5953    }
    6054
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj

    r3635 r3662  
    8484  </ItemGroup>
    8585  <ItemGroup>
    86     <Compile Include="Analyzers\MultiPopulationBestTSPSolutionAnalyzer.cs" />
    8786    <Compile Include="Analyzers\PopulationBestTSPSolutionAnalyzer.cs" />
    88     <Compile Include="Analyzers\BestTSPSolutionAnalyzer.cs" />
    8987    <Compile Include="Evaluators\TSPEuclideanPathEvaluator.cs" />
    9088    <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" />
    9189    <Compile Include="HeuristicLabProblemsTravelingSalesmanPlugin.cs" />
    92     <Compile Include="Interfaces\IBestTSPSolutionAnalyzer.cs" />
    9390    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveEuclideanPathEvaluator.cs" />
    9491    <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveGeoPathEvaluator.cs" />
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs

    r3635 r3662  
    124124      get { return operators; }
    125125    }
    126     private IEnumerable<IBestTSPSolutionAnalyzer> BestTSPSolutionAnalyzers {
    127       get { return operators.OfType<IBestTSPSolutionAnalyzer>(); }
     126    private PopulationBestTSPSolutionAnalyzer BestTSPSolutionAnalyzer {
     127      get { return operators.OfType<PopulationBestTSPSolutionAnalyzer>().FirstOrDefault(); }
    128128    }
    129129    #endregion
     
    231231      ParameterizeSolutionCreator();
    232232      ParameterizeEvaluator();
    233       ParameterizeAnalyzers();
     233      ParameterizeAnalyzer();
    234234      ParameterizeOperators();
    235235      OnSolutionCreatorChanged();
     
    237237    private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) {
    238238      ParameterizeEvaluator();
    239       ParameterizeAnalyzers();
     239      ParameterizeAnalyzer();
    240240      ParameterizeOperators();
    241241    }
     
    244244      ParameterizeEvaluator();
    245245      UpdateMoveEvaluators();
    246       ParameterizeAnalyzers();
     246      ParameterizeAnalyzer();
    247247      ClearDistanceMatrix();
    248248      OnEvaluatorChanged();
    249249    }
    250250    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    251       ParameterizeAnalyzers();
     251      ParameterizeAnalyzer();
    252252    }
    253253    private void MoveGenerator_InversionMoveParameter_ActualNameChanged(object sender, EventArgs e) {
     
    280280    private void InitializeOperators() {
    281281      operators = new List<IOperator>();
    282       operators.Add(new BestTSPSolutionAnalyzer());
    283282      operators.Add(new PopulationBestTSPSolutionAnalyzer());
    284       operators.Add(new MultiPopulationBestTSPSolutionAnalyzer());
    285       ParameterizeAnalyzers();
     283      ParameterizeAnalyzer();
    286284      operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>().Cast<IOperator>());
    287285      ParameterizeOperators();
     
    325323      }
    326324    }
    327     private void ParameterizeAnalyzers() {
    328       foreach (IBestTSPSolutionAnalyzer analyzer in BestTSPSolutionAnalyzers) {
    329         analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
    330         analyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
    331         analyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
    332         analyzer.ResultsParameter.ActualName = "Results";
    333       }
     325    private void ParameterizeAnalyzer() {
     326      BestTSPSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
     327      BestTSPSolutionAnalyzer.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
     328      BestTSPSolutionAnalyzer.PermutationParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
     329      BestTSPSolutionAnalyzer.ResultsParameter.ActualName = "Results";
    334330    }
    335331    private void ParameterizeOperators() {
Note: See TracChangeset for help on using the changeset viewer.