Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/06/11 13:00:12 (13 years ago)
Author:
svonolfe
Message:

Added support for pickups and deliveries (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/Capacitated/BestCapacitatedVRPSolutionAnalyzer.cs

    r4752 r6710  
    7070        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Overload", "The overloads of the VRP solutions which should be analyzed."));
    7171
    72         Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best TSP solution."));
     72        Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution."));
    7373        Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
    7474    }
     
    9191      int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    9292
    93       IVRPEncoding best = solutions[i] as IVRPEncoding;
    9493      VRPSolution solution = BestSolutionParameter.ActualValue;
    95       if (!results.ContainsKey("Best VRP Solution Overload")) {
    96         results.Add(new Result("Best VRP Solution Overload", new DoubleValue(overloads[i].Value)));
    97       } else {
    98         if (qualities[i].Value <= solution.Quality.Value) {
    99           (results["Best VRP Solution Overload"].Value as DoubleValue).Value = overloads[i].Value;
     94      if (solution != null) {
     95        if (!results.ContainsKey("Best VRP Solution Overload")) {
     96          results.Add(new Result("Best VRP Solution Overload", new DoubleValue(overloads[i].Value)));
     97        } else {
     98          if (qualities[i].Value <= solution.Quality.Value) {
     99            (results["Best VRP Solution Overload"].Value as DoubleValue).Value = overloads[i].Value;
     100          }
    100101        }
    101102      }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/TimeWindowed/BestTimeWindowedVRPSolutionAnalyzer.cs

    r4752 r6710  
    7373        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Tardiness", "The tardiness of the VRP solutions which should be analyzed."));
    7474        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("TravelTime", "The travel times of the VRP solutions which should be analyzed."));
    75  
    76         Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best TSP solution."));
     75
     76        Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution."));
    7777        Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored."));
    7878    }
     
    9696      int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    9797
    98       IVRPEncoding best = solutions[i] as IVRPEncoding;
    9998      VRPSolution solution = BestSolutionParameter.ActualValue;
    100       if (!results.ContainsKey("Best VRP Solution Tardiness")) {
    101         results.Add(new Result("Best VRP Solution Tardiness", new DoubleValue(tardinesses[i].Value)));
    102         results.Add(new Result("Best VRP Solution TravelTime", new DoubleValue(travelTimes[i].Value)));
    103       } else {
    104         if (qualities[i].Value <= solution.Quality.Value) {
    105           (results["Best VRP Solution Tardiness"].Value as DoubleValue).Value = tardinesses[i].Value;
    106           (results["Best VRP Solution TravelTime"].Value as DoubleValue).Value = travelTimes[i].Value;
     99      if (solution != null) {
     100        if (!results.ContainsKey("Best VRP Solution Tardiness")) {
     101          results.Add(new Result("Best VRP Solution Tardiness", new DoubleValue(tardinesses[i].Value)));
     102          results.Add(new Result("Best VRP Solution TravelTime", new DoubleValue(travelTimes[i].Value)));
     103        } else {
     104          if (qualities[i].Value <= solution.Quality.Value) {
     105            (results["Best VRP Solution Tardiness"].Value as DoubleValue).Value = tardinesses[i].Value;
     106            (results["Best VRP Solution TravelTime"].Value as DoubleValue).Value = travelTimes[i].Value;
     107          }
    107108        }
    108109      }
Note: See TracChangeset for help on using the changeset viewer.