Free cookie consent management tool by TermsFeed Policy Generator

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

Operator architecture refactoring (#95)

  • worked on algorithms and parameters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs

    r2890 r2891  
    7575    public TSP()
    7676      : base() {
    77       Parameters.Add(new OptionalValueParameter<BoolData>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolData(false)));
    78       Parameters.Add(new OptionalValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0)));
    79       Parameters.Add(new OptionalValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions."));
    80       Parameters.Add(new OptionalValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions."));
     77      RandomPermutationCreator creator = new RandomPermutationCreator();
     78      TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
     79
     80      Parameters.Add(new ValueParameter<BoolData>("Maximization", "Set to false as the Traveling Salesman Problem is a minimization problem.", new BoolData(false)));
     81      Parameters.Add(new ValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0)));
     82      Parameters.Add(new ValueParameter<IPermutationCreator>("SolutionCreator", "The operator which should be used to create new TSP solutions.", creator));
     83      Parameters.Add(new ValueParameter<ITSPEvaluator>("Evaluator", "The operator which should be used to evaluate TSP solutions.", evaluator));
    8184      Parameters.Add(new OptionalValueParameter<DoubleData>("BestKnownQuality", "The quality of the best known solution of this TSP instance."));
     85
     86      creator.PermutationParameter.ActualName = "TSPTour";
     87      creator.LengthParameter.Value = new IntData(0);
     88      evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
     89      evaluator.PermutationParameter.ActualName = creator.PermutationParameter.ActualName;
     90      evaluator.QualityParameter.ActualName = "TSPTourLength";
    8291
    8392      MaximizationParameter.ValueChanged += new EventHandler(MaximizationParameter_ValueChanged);
    8493      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    8594      EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
    86 
    87       RandomPermutationCreator creator = new RandomPermutationCreator();
    88       creator.PermutationParameter.ActualName = "TSPTour";
    89       creator.LengthParameter.Value = new IntData(0);
    90       SolutionCreatorParameter.Value = creator;
    91       TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator();
    92       evaluator.CoordinatesParameter.ActualName = CoordinatesParameter.Name;
    93       evaluator.PermutationParameter.ActualName = creator.PermutationParameter.ActualName;
    94       evaluator.QualityParameter.ActualName = "TSPTourLength";
    95       EvaluatorParameter.Value = evaluator;
    9695
    9796      var ops = ApplicationManager.Manager.GetInstances<IPermutationOperator>();
Note: See TracChangeset for help on using the changeset viewer.