Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17708


Ignore:
Timestamp:
08/03/20 08:44:52 (4 years ago)
Author:
abeham
Message:

#2521: working on VRP

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj

    r17698 r17708  
    135135    <Compile Include="Analyzer\ConstraintRelaxation\TimeWindowed\TimeWindowRelaxationVRPAnalyzer.cs" />
    136136    <Compile Include="Analyzer\VRPSolution.cs" />
     137    <Compile Include="Encodings\MultiVRPEncoding.cs" />
    137138    <Compile Include="Encodings\Alba\AlbaEncoding.cs" />
     139    <Compile Include="Encodings\GVR\GVREncoding.cs" />
     140    <Compile Include="Encodings\Potvin\PotvinEncoding.cs" />
    138141    <Compile Include="Encodings\Potvin\Moves\TwoOptStar\IPotvinTwoOptStarMoveOperator.cs" />
    139142    <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarExhaustiveMoveGenerator.cs" />
     
    147150    <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMultiMoveGenerator.cs" />
    148151    <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarSingleMoveGenerator.cs" />
     152    <Compile Include="Encodings\Prins\PrinsEncoding.cs" />
     153    <Compile Include="Encodings\Zhu\ZhuEncoding.cs" />
    149154    <Compile Include="Improver\VRPImprovementOperator.cs" />
    150155    <Compile Include="Improver\VRPIntraRouteImprovementOperator.cs" />
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluation.cs

    r17226 r17708  
    2121
    2222
     23using HEAL.Attic;
     24using HeuristicLab.Common;
     25using HeuristicLab.Core;
     26
    2327namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
     28  [Item("CVRPInsertionInfo", "")]
     29  [StorableType("f951554e-dbe1-4dfb-a6b2-b477b9f79fcd")]
    2430  public class CVRPInsertionInfo : StopInsertionInfo {
    25     private double spareCapacity;
     31    [Storable] public double SpareCapacity { get; private set; }
    2632
    27     public double SpareCapacity {
    28       get { return spareCapacity; }
     33    [StorableConstructor]
     34    protected CVRPInsertionInfo(StorableConstructorFlag _) : base(_) { }
     35    protected CVRPInsertionInfo(CVRPInsertionInfo original, Cloner cloner)
     36      : base(original, cloner) {
     37      SpareCapacity = original.SpareCapacity;
     38    }
     39    public CVRPInsertionInfo(int start, int end, double spareCapacity)
     40      : base(start, end) {
     41      SpareCapacity = spareCapacity;
    2942    }
    3043
    31     public CVRPInsertionInfo(int start, int end, double spareCapacity)
    32       : base(start, end) {
    33       this.spareCapacity = spareCapacity;
     44    public override IDeepCloneable Clone(Cloner cloner) {
     45      return new CVRPInsertionInfo(this, cloner);
    3446    }
    3547  }
    3648
     49  [Item("CVRPEvaluation", "")]
     50  [StorableType("e3d4c547-3028-4c95-8ea8-1fe234d54ed3")]
    3751  public class CVRPEvaluation : VRPEvaluation {
    38     public double Overload { get; set; }
     52    [Storable] public double Overload { get; set; }
     53
     54    [StorableConstructor]
     55    protected CVRPEvaluation(StorableConstructorFlag _) : base(_) { }
     56    protected CVRPEvaluation(CVRPEvaluation original, Cloner cloner)
     57      : base(original, cloner) {
     58      Overload = original.Overload;
     59    }
     60    public CVRPEvaluation() { }
     61
     62
     63    public override IDeepCloneable Clone(Cloner cloner) {
     64      return new CVRPEvaluation(this, cloner);
     65    }
    3966  }
    4067}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluation.cs

    r17226 r17708  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
     24using HEAL.Attic;
     25using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2327
    2428namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
     29  [Item("CVRPPDTWInsertionInfo", "")]
     30  [StorableType("acb4ecf2-70a5-42ec-a2a5-68b11bd033e2")]
    2531  public class CVRPPDTWInsertionInfo : CVRPTWInsertionInfo {
    26     private List<int> visited;
     32    [Storable] public List<int> Visited { get; private set; }
     33    [Storable] public double ArrivalSpareCapacity { get; private set; }
    2734
    28     public List<int> Visited {
    29       get { return visited; }
     35    [StorableConstructor]
     36    protected CVRPPDTWInsertionInfo(StorableConstructorFlag _) : base(_) { }
     37    protected CVRPPDTWInsertionInfo(CVRPPDTWInsertionInfo original, Cloner cloner)
     38      : base(original, cloner) {
     39      Visited = original.Visited.ToList();
     40      ArrivalSpareCapacity = original.ArrivalSpareCapacity;
    3041    }
    31 
    32     private double arrivalSpareCapacity;
    33 
    34     public double ArrivalSpareCapacity {
    35       get { return arrivalSpareCapacity; }
    36     }
    37 
    3842    public CVRPPDTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime,
    3943      double arrivalTime, double leaveTime, double spareTime, double waitingTime, List<int> visited, double arrivalSpareCapacity)
    4044      : base(start, end, spareCapacity, tourStartTime, arrivalTime, leaveTime, spareTime, waitingTime) {
    41       this.visited = visited;
    42       this.arrivalSpareCapacity = arrivalSpareCapacity;
     45      Visited = visited;
     46      ArrivalSpareCapacity = arrivalSpareCapacity;
     47    }
     48
     49    public override IDeepCloneable Clone(Cloner cloner) {
     50      return new CVRPPDTWInsertionInfo(this, cloner);
    4351    }
    4452  }
    4553
     54  [Item("CVRPPDTWEvaluation", "")]
     55  [StorableType("877ae91a-708f-4b32-95f3-d790e0efc018")]
    4656  public class CVRPPDTWEvaluation : CVRPTWEvaluation {
    47     public int PickupViolations { get; set; }
     57    [Storable] public int PickupViolations { get; set; }
     58
     59    [StorableConstructor]
     60    protected CVRPPDTWEvaluation(StorableConstructorFlag _) : base(_) { }
     61    protected CVRPPDTWEvaluation(CVRPPDTWEvaluation original, Cloner cloner)
     62      : base(original, cloner) {
     63      PickupViolations = original.PickupViolations;
     64    }
     65    public CVRPPDTWEvaluation() { }
     66
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new CVRPPDTWEvaluation(this, cloner);
     69    }
    4870  }
    4971}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluation.cs

    r17226 r17708  
    2121
    2222
     23using HEAL.Attic;
     24using HeuristicLab.Common;
     25using HeuristicLab.Core;
     26
    2327namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
     28  [Item("CVRPTWInsertionInfo", "")]
     29  [StorableType("487635b5-2682-42a2-9ec2-1a210e6ce88c")]
    2430  public class CVRPTWInsertionInfo : CVRPInsertionInfo {
    25     private double tourStartTime;
    2631
    27     public double TourStartTime {
    28       get { return tourStartTime; }
     32    [Storable] public double TourStartTime { get; private set; }
     33    [Storable] public double ArrivalTime { get; private set; }
     34    [Storable] public double LeaveTime { get; private set; }
     35    [Storable] public double SpareTime { get; private set; }
     36    [Storable] public double WaitingTime { get; private set; }
     37
     38
     39    [StorableConstructor]
     40    protected CVRPTWInsertionInfo(StorableConstructorFlag _) : base(_) { }
     41    protected CVRPTWInsertionInfo(CVRPTWInsertionInfo original, Cloner cloner)
     42      : base(original, cloner) {
     43      TourStartTime = original.TourStartTime;
     44      ArrivalTime = original.ArrivalTime;
     45      LeaveTime = original.LeaveTime;
     46      SpareTime = original.SpareTime;
     47      WaitingTime = original.WaitingTime;
    2948    }
    30 
    31     private double arrivalTime;
    32 
    33     public double ArrivalTime {
    34       get { return arrivalTime; }
    35     }
    36 
    37     private double leaveTime;
    38 
    39     public double LeaveTime {
    40       get { return leaveTime; }
    41     }
    42 
    43     private double spareTime;
    44 
    45     public double SpareTime {
    46       get { return spareTime; }
    47     }
    48 
    49     private double waitingTime;
    50 
    51     public double WaitingTime {
    52       get { return waitingTime; }
    53     }
    54 
    5549    public CVRPTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime, double arrivalTime, double leaveTime, double spareTime, double waitingTime)
    5650      : base(start, end, spareCapacity) {
    57       this.tourStartTime = tourStartTime;
    58       this.arrivalTime = arrivalTime;
    59       this.leaveTime = leaveTime;
    60       this.spareTime = spareTime;
    61       this.waitingTime = waitingTime;
     51      TourStartTime = tourStartTime;
     52      ArrivalTime = arrivalTime;
     53      LeaveTime = leaveTime;
     54      SpareTime = spareTime;
     55      WaitingTime = waitingTime;
    6256    }
    6357  }
    6458
     59  [Item("CVRPTWEvaluation", "")]
     60  [StorableType("b3b31244-5ac8-4007-9ae6-249e2a7d5321")]
    6561  public class CVRPTWEvaluation : CVRPEvaluation {
    66     public double Tardiness { get; set; }
    67     public double TravelTime { get; set; }
     62    [Storable] public double Tardiness { get; set; }
     63    [Storable] public double TravelTime { get; set; }
     64
     65    [StorableConstructor]
     66    protected CVRPTWEvaluation(StorableConstructorFlag _) : base(_) { }
     67    protected CVRPTWEvaluation(CVRPTWEvaluation original, Cloner cloner)
     68      : base(original, cloner) {
     69      Tardiness = original.Tardiness;
     70      TravelTime = original.TravelTime;
     71    }
     72    public CVRPTWEvaluation() { }
     73
     74    public override IDeepCloneable Clone(Cloner cloner) {
     75      return new CVRPTWEvaluation(this, cloner);
     76    }
    6877  }
    6978}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluation.cs

    r17226 r17708  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
     24using HEAL.Attic;
     25using HeuristicLab.Common;
     26using HeuristicLab.Core;
     27using HeuristicLab.Optimization;
    2328
    2429namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
    25   public class StopInsertionInfo {
    26     private int start;
     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; }
    2735
    28     public int Start {
    29       get { return start; }
     36
     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;
     43    }
     44    public StopInsertionInfo(int start, int end)
     45      : base() {
     46      Start = start;
     47      End = end;
    3048    }
    3149
    32     private int end;
    33 
    34     public int End {
    35       get { return end; }
    36     }
    37 
    38     public StopInsertionInfo(int start, int end)
    39       : base() {
    40       this.start = start;
    41       this.end = end;
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new StopInsertionInfo(this, cloner);
    4252    }
    4353  }
    4454
    45   public class TourInsertionInfo {
    46     public double Penalty { get; set; }
    47     public double Quality { get; set; }
     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;
    4862
    49     public int Vehicle { get; set; }
    50 
    51     private List<StopInsertionInfo> stopInsertionInfos;
    52 
     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    }
    5372    public TourInsertionInfo(int vehicle)
    5473      : base() {
    5574      stopInsertionInfos = new List<StopInsertionInfo>();
    5675      Vehicle = vehicle;
     76    }
     77
     78    public override IDeepCloneable Clone(Cloner cloner) {
     79      return new TourInsertionInfo(this, cloner);
    5780    }
    5881
     
    7093  }
    7194
    72   public class InsertionInfo {
    73     private List<TourInsertionInfo> tourInsertionInfos;
     95  [Item("InsertionInfo", "")]
     96  [StorableType("ba569eb3-df25-4f73-bfa0-246b38c1d520")]
     97  public class InsertionInfo : Item {
     98    [Storable] private List<TourInsertionInfo> tourInsertionInfos;
    7499
     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    }
    75106    public InsertionInfo()
    76107      : base() {
    77108      tourInsertionInfos = new List<TourInsertionInfo>();
     109    }
     110
     111    public override IDeepCloneable Clone(Cloner cloner) {
     112      return new InsertionInfo(this, cloner);
    78113    }
    79114
     
    87122  }
    88123
    89   public class VRPEvaluation {
    90     public double Quality { get; set; }
    91     public double Distance { get; set; }
    92     public int VehicleUtilization { get; set; }
    93     public InsertionInfo InsertionInfo { get; set; }
     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; }
    94132
    95     public double Penalty { get; set; }
    96133
    97     public VRPEvaluation() {
     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() {
    98145      InsertionInfo = new InsertionInfo();
     146    }
     147
     148    public override IDeepCloneable Clone(Cloner cloner) {
     149      return new VRPEvaluation(this, cloner);
    99150    }
    100151  }
Note: See TracChangeset for help on using the changeset viewer.