Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/15 23:38:51 (8 years ago)
Author:
abeham
Message:

#2221:

  • Completely refactored PTSP branch
    • Added two sets of problem instances based on TSPLIB: homogeneous and heterogeneous
    • Implemented missing EvaluateByCoordinates for 1-shift moves
    • Made it clear that move evaluators are for estimated PTSP only
    • Changed parameter realization from a rather strange list of list of ints to a list of bool arrays
    • Reusing code of the 2-opt and 1-shift move evaluators in 2.5 move evaluator
    • Introducing distance calculators to properly handle the case when no distance matrix is given (previous code only worked with distance matrix and without only with euclidean distance in some settings)
    • Fixed several smaller code issues: protected, static, method parameters, copy & paste, interfaces, naming, parameters, serialization hooks, license headers, doc comments, data types
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/ProbabilisticTravelingSalesmanProblemView.cs

    r12269 r13412  
    2121
    2222using System;
    23 using System.Windows.Forms;
     23using HeuristicLab.Data;
    2424using HeuristicLab.MainForm;
    2525using HeuristicLab.Optimization.Views;
    26 using HeuristicLab.Problems.PTSP;
    27 using HeuristicLab.Data;
     26using HeuristicLab.Random;
    2827
    2928namespace HeuristicLab.Problems.PTSP.Views {
     
    4039
    4140    /// <summary>
    42     /// Initializes a new instance of <see cref="ProbabilisticTravelingSalesmanView"/>.
     41    /// Initializes a new instance of <see cref="ProbabilisticTravelingSalesmanProblemView"/>.
    4342    /// </summary>
    4443    public ProbabilisticTravelingSalesmanProblemView() {
     
    4746
    4847    protected override void DeregisterContentEvents() {
    49       Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
    50       Content.ProbabilityMatrixParameter.ValueChanged -= new EventHandler(ProbabilityParameter_ValueChanged);
    51       //Content.BestKnownQualityParameter.ValueChanged -= new EventHandler(BestKnownQualityParameter_ValueChanged);
    52       Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
     48      Content.CoordinatesParameter.ValueChanged -= CoordinatesParameter_ValueChanged;
     49      Content.ProbabilitiesParameter.ValueChanged -= ProbabilityParameter_ValueChanged;
     50      Content.BestKnownSolutionParameter.ValueChanged -= BestKnownSolutionParameter_ValueChanged;
    5351      base.DeregisterContentEvents();
    5452    }
    5553    protected override void RegisterContentEvents() {
    5654      base.RegisterContentEvents();
    57       Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
    58       Content.ProbabilityMatrixParameter.ValueChanged += new EventHandler(ProbabilityParameter_ValueChanged);
    59       //Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged);
    60       Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
     55      Content.CoordinatesParameter.ValueChanged += CoordinatesParameter_ValueChanged;
     56      Content.ProbabilitiesParameter.ValueChanged += ProbabilityParameter_ValueChanged;
     57      Content.BestKnownSolutionParameter.ValueChanged += BestKnownSolutionParameter_ValueChanged;
    6158    }
    6259    protected override void OnContentChanged() {
     
    6562        pathPTSPTourView.Content = null;
    6663      } else {
    67         pathPTSPTourView.Content = new PathPTSPTour(Content.Coordinates, Content.ProbabilityMatrix, Content.BestKnownSolution, new DoubleValue(Content.BestKnownQuality));
     64        pathPTSPTourView.Content = new PathPTSPTour(Content.Coordinates, Content.Probabilities, Content.BestKnownSolution, new DoubleValue(Content.BestKnownQuality));
    6865      }
    6966    }
     
    7774      pathPTSPTourView.Content.Coordinates = Content.Coordinates;
    7875    }
    79 
    8076    private void ProbabilityParameter_ValueChanged(object sender, EventArgs e) {
    81       pathPTSPTourView.Content.Probabilities = Content.ProbabilityMatrix;
    82     }
    83     private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) {
    84       pathPTSPTourView.Content.Quality = new DoubleValue(Content.BestKnownQuality);
     77      pathPTSPTourView.Content.Probabilities = Content.Probabilities;
    8578    }
    8679    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
    8780      pathPTSPTourView.Content.Permutation = Content.BestKnownSolution;
     81      pathPTSPTourView.Content.Quality = new DoubleValue(Content.Evaluate(Content.BestKnownSolution, new MersenneTwister()));
    8882    }
    8983  }
Note: See TracChangeset for help on using the changeset viewer.