Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2205_OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluation.cs @ 15895

Last change on this file since 15895 was 14677, checked in by abeham, 8 years ago

#2205: added results tab to solution view to analyze vrp solution in more detail

  • reorganized insertion infos and adapted some evaluators and instances
File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.Globalization;
23using System.Linq;
24using System.Text;
25
26namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
27  public class CVRPStopInsertionInfo : StopInsertionInfo {
28    private double spareCapacity;
29
30    public double SpareCapacity {
31      get { return spareCapacity; }
32    }
33
34    public CVRPStopInsertionInfo(int start, int end, double distance, double spareCapacity)
35      : base(start, end, distance) {
36      this.spareCapacity = spareCapacity;
37    }
38
39    protected override void GetStopInsertionReport(StringBuilder builder) {
40      base.GetStopInsertionReport(builder);
41      builder.Append("Capacity left:\t");
42      builder.AppendLine(SpareCapacity.ToString(CultureInfo.CurrentCulture));
43    }
44  }
45
46  public class CVRPTourInsertionInfo : TourInsertionInfo {
47    private double capacity;
48
49    public virtual double SpareCapacity {
50      get { return stopInsertionInfos.Count == 0 ? capacity : ((CVRPStopInsertionInfo)stopInsertionInfos.Last()).SpareCapacity; }
51    }
52   
53    public CVRPTourInsertionInfo(int vehicle, double capacity)
54      : base(vehicle) {
55      this.capacity = capacity;
56    }
57
58    protected override void GetTourInsertionReport(StringBuilder builder) {
59      base.GetTourInsertionReport(builder);
60      builder.Append("Capacity left:\t");
61      builder.AppendLine(SpareCapacity.ToString(CultureInfo.CurrentCulture));
62    }
63  }
64
65  public class CVRPEvaluation : VRPEvaluation {
66    public double Overload { get; set; }
67
68    protected override void GetEvaluationReport(StringBuilder builder) {
69      base.GetEvaluationReport(builder);
70      builder.Append("Overload:\t");
71      builder.AppendLine(Overload.ToString(CultureInfo.CurrentCulture));
72    }
73  }
74}
Note: See TracBrowser for help on using the repository browser.