Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17697


Ignore:
Timestamp:
07/23/20 23:27:28 (4 years ago)
Author:
abeham
Message:

#2521: changed parameterization in TSP

Location:
branches/2521_ProblemRefactoring
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/BasicProblems/SingleObjectiveProblem.cs

    r17612 r17697  
    199199        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
    200200      }
     201      foreach (var op in Operators.OfType<ISingleObjectiveImprovementOperator>()) {
     202        op.SolutionParameter.ActualName = Encoding.Name;
     203        op.SolutionParameter.Hidden = true;
     204      }
     205      foreach (var op in Operators.OfType<ISingleObjectivePathRelinker>()) {
     206        op.ParentsParameter.ActualName = Encoding.Name;
     207        op.ParentsParameter.Hidden = true;
     208      }
    201209    }
    202210
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TSP.cs

    r17695 r17697  
    163163
    164164    public static ITSPData GetDataFromInstance(TSPData input) {
    165       ITSPData tspData = null;
     165      ITSPData tspData;
    166166      if (input.Dimension <= DistanceMatrixSizeLimit) {
    167167        tspData = new MatrixTSPData(input.Name, input.GetDistanceMatrix(), input.Coordinates) { Description = input.Description };
     
    208208
    209209    private void InitializeOperators() {
    210       Operators.Add(new TSPImprovementOperator());
    211       Operators.Add(new TSPMultipleGuidesPathRelinker());
    212       Operators.Add(new TSPPathRelinker());
    213       Operators.Add(new TSPSimultaneousPathRelinker());
    214 
    215       Operators.Add(new TSPAlleleFrequencyAnalyzer());
     210      var ops = new List<IItem>() { new TSPImprovementOperator(), new TSPMultipleGuidesPathRelinker(),
     211        new TSPPathRelinker(), new TSPSimultaneousPathRelinker(), new TSPAlleleFrequencyAnalyzer() };
    216212      foreach (var op in ApplicationManager.Manager.GetInstances<ITSPMoveEvaluator>()) {
    217         Encoding.ConfigureOperator(op);
    218         Operators.Add(op);
    219       }
    220       ParameterizeOperators();
    221     }
    222 
    223     private void ParameterizeOperators() {
     213        ops.Add(op);
     214      }
     215      Encoding.ConfigureOperators(ops);
     216      Operators.AddRange(ops);
     217    }
     218
     219    protected override void ParameterizeOperators() {
     220      base.ParameterizeOperators();
     221      Parameterize();
     222    }
     223
     224    private void Parameterize() {
    224225      foreach (var op in Operators.OfType<TSPAlleleFrequencyAnalyzer>()) {
    225226        op.MaximizationParameter.ActualName = MaximizationParameter.Name;
     
    238239        op.TSPTourParameter.Hidden = true;
    239240      }
    240       foreach (var op in Operators.OfType<ISingleObjectiveImprovementOperator>()) {
    241         op.SolutionParameter.ActualName = Encoding.Name;
    242         op.SolutionParameter.Hidden = true;
    243       }
    244       foreach (ISingleObjectivePathRelinker op in Operators.OfType<ISingleObjectivePathRelinker>()) {
    245         op.ParentsParameter.ActualName = Encoding.Name;
    246         op.ParentsParameter.Hidden = true;
    247       }
    248       foreach (ISolutionSimilarityCalculator op in Operators.OfType<ISolutionSimilarityCalculator>()) {
    249         op.SolutionVariableName = Encoding.Name;
    250         op.QualityVariableName = Evaluator.QualityParameter.ActualName;
    251       }
    252241    }
    253242  }
Note: See TracChangeset for help on using the changeset viewer.