[4454] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[17226] | 3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[4454] | 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 |
|
---|
[4362] | 22 | using System.Collections.Generic;
|
---|
[17708] | 23 | using System.Linq;
|
---|
| 24 | using HEAL.Attic;
|
---|
| 25 | using HeuristicLab.Common;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using HeuristicLab.Optimization;
|
---|
[4362] | 28 |
|
---|
[4363] | 29 | namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
|
---|
[17708] | 30 | [Item("StopInsertionInfo", "")]
|
---|
| 31 | [StorableType("e4e2657a-0af9-4f1c-b396-887ad5b6f459")]
|
---|
| 32 | public class StopInsertionInfo : Item {
|
---|
| 33 | [Storable] public int Start { get; private set; }
|
---|
| 34 | [Storable] public int End { get; private set; }
|
---|
[6752] | 35 |
|
---|
| 36 |
|
---|
[17708] | 37 | [StorableConstructor]
|
---|
| 38 | protected StopInsertionInfo(StorableConstructorFlag _) : base(_) { }
|
---|
| 39 | protected StopInsertionInfo(StopInsertionInfo original, Cloner cloner)
|
---|
| 40 | : base(original, cloner) {
|
---|
| 41 | Start = original.Start;
|
---|
| 42 | End = original.End;
|
---|
[6752] | 43 | }
|
---|
| 44 | public StopInsertionInfo(int start, int end)
|
---|
| 45 | : base() {
|
---|
[17708] | 46 | Start = start;
|
---|
| 47 | End = end;
|
---|
[6752] | 48 | }
|
---|
[17708] | 49 |
|
---|
| 50 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 51 | return new StopInsertionInfo(this, cloner);
|
---|
| 52 | }
|
---|
[6752] | 53 | }
|
---|
| 54 |
|
---|
[17708] | 55 | [Item("TourInsertionInfo", "")]
|
---|
| 56 | [StorableType("25a61cca-120b-43e2-845a-d290352ca1e9")]
|
---|
| 57 | public class TourInsertionInfo : Item {
|
---|
| 58 | [Storable] public double Penalty { get; set; }
|
---|
| 59 | [Storable] public double Quality { get; set; }
|
---|
| 60 | [Storable] public int Vehicle { get; set; }
|
---|
| 61 | [Storable] private List<StopInsertionInfo> stopInsertionInfos;
|
---|
[6752] | 62 |
|
---|
[17708] | 63 | [StorableConstructor]
|
---|
| 64 | protected TourInsertionInfo(StorableConstructorFlag _) : base(_) { }
|
---|
| 65 | protected TourInsertionInfo(TourInsertionInfo original, Cloner cloner)
|
---|
| 66 | : base(original, cloner) {
|
---|
| 67 | Penalty = original.Penalty;
|
---|
| 68 | Quality = original.Quality;
|
---|
| 69 | Vehicle = original.Vehicle;
|
---|
| 70 | stopInsertionInfos = original.stopInsertionInfos.Select(cloner.Clone).ToList();
|
---|
| 71 | }
|
---|
[6883] | 72 | public TourInsertionInfo(int vehicle)
|
---|
[6752] | 73 | : base() {
|
---|
| 74 | stopInsertionInfos = new List<StopInsertionInfo>();
|
---|
[6883] | 75 | Vehicle = vehicle;
|
---|
[6752] | 76 | }
|
---|
| 77 |
|
---|
[17708] | 78 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 79 | return new TourInsertionInfo(this, cloner);
|
---|
| 80 | }
|
---|
| 81 |
|
---|
[6752] | 82 | public void AddStopInsertionInfo(StopInsertionInfo info) {
|
---|
| 83 | stopInsertionInfos.Add(info);
|
---|
| 84 | }
|
---|
| 85 |
|
---|
[8053] | 86 | public StopInsertionInfo GetStopInsertionInfo(int stop) {
|
---|
[6752] | 87 | return stopInsertionInfos[stop];
|
---|
[8053] | 88 | }
|
---|
[6752] | 89 |
|
---|
| 90 | public int GetStopCount() {
|
---|
| 91 | return stopInsertionInfos.Count;
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
[17708] | 95 | [Item("InsertionInfo", "")]
|
---|
| 96 | [StorableType("ba569eb3-df25-4f73-bfa0-246b38c1d520")]
|
---|
| 97 | public class InsertionInfo : Item {
|
---|
| 98 | [Storable] private List<TourInsertionInfo> tourInsertionInfos;
|
---|
[8053] | 99 |
|
---|
[17708] | 100 | [StorableConstructor]
|
---|
| 101 | protected InsertionInfo(StorableConstructorFlag _) : base(_) { }
|
---|
| 102 | protected InsertionInfo(InsertionInfo original, Cloner cloner)
|
---|
| 103 | : base(original, cloner) {
|
---|
| 104 | tourInsertionInfos = original.tourInsertionInfos.Select(cloner.Clone).ToList();
|
---|
| 105 | }
|
---|
[6752] | 106 | public InsertionInfo()
|
---|
| 107 | : base() {
|
---|
[8053] | 108 | tourInsertionInfos = new List<TourInsertionInfo>();
|
---|
[6752] | 109 | }
|
---|
| 110 |
|
---|
[17708] | 111 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 112 | return new InsertionInfo(this, cloner);
|
---|
| 113 | }
|
---|
| 114 |
|
---|
[8053] | 115 | public void AddTourInsertionInfo(TourInsertionInfo info) {
|
---|
[6752] | 116 | tourInsertionInfos.Add(info);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | public TourInsertionInfo GetTourInsertionInfo(int tour) {
|
---|
| 120 | return tourInsertionInfos[tour];
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
[8053] | 123 |
|
---|
[17708] | 124 | [Item("VRPEvaluation", "")]
|
---|
| 125 | [StorableType("0c4dfa78-8e41-4558-b2dd-4a22954c35ba")]
|
---|
| 126 | public class VRPEvaluation : EvaluationResult {
|
---|
| 127 | [Storable] public double Quality { get; set; }
|
---|
| 128 | [Storable] public double Distance { get; set; }
|
---|
| 129 | [Storable] public int VehicleUtilization { get; set; }
|
---|
| 130 | [Storable] public InsertionInfo InsertionInfo { get; set; }
|
---|
| 131 | [Storable] public double Penalty { get; set; }
|
---|
[4362] | 132 |
|
---|
[6752] | 133 |
|
---|
[17708] | 134 | [StorableConstructor]
|
---|
| 135 | protected VRPEvaluation(StorableConstructorFlag _) : base(_) { }
|
---|
| 136 | protected VRPEvaluation(VRPEvaluation original, Cloner cloner)
|
---|
| 137 | : base(original, cloner) {
|
---|
| 138 | Quality = original.Quality;
|
---|
| 139 | Distance = original.Distance;
|
---|
| 140 | VehicleUtilization = original.VehicleUtilization;
|
---|
| 141 | InsertionInfo = cloner.Clone(original.InsertionInfo);
|
---|
| 142 | Penalty = original.Penalty;
|
---|
| 143 | }
|
---|
| 144 | public VRPEvaluation() : base() {
|
---|
[6752] | 145 | InsertionInfo = new InsertionInfo();
|
---|
| 146 | }
|
---|
[17708] | 147 |
|
---|
| 148 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 149 | return new VRPEvaluation(this, cloner);
|
---|
| 150 | }
|
---|
[4362] | 151 | }
|
---|
| 152 | }
|
---|