Changeset 8053 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs
- Timestamp:
- 06/19/12 13:17:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs
r6854 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; 25 using System.Text; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Common; 28 25 using HeuristicLab.Core; 29 using HeuristicLab.Parameters;30 26 using HeuristicLab.Data; 31 27 using HeuristicLab.Optimization; 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 30 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Problems.VehicleRouting.Interfaces; 33 32 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Common;35 33 36 34 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 37 35 [Item("MultiDepotVRPProblemInstance", "Represents a multi depot VRP instance.")] 38 36 [StorableClass] 39 public class MultiDepotVRPProblemInstance : VRPProblemInstance, IMultiDepotProblemInstance {37 public class MultiDepotVRPProblemInstance : VRPProblemInstance, IMultiDepotProblemInstance { 40 38 protected IValueParameter<IntValue> DepotsParameter { 41 39 get { return (IValueParameter<IntValue>)Parameters["Depots"]; } … … 60 58 } 61 59 } 62 60 63 61 protected override IEnumerable<IOperator> GetOperators() { 64 62 return ApplicationManager.Manager.GetInstances<IMultiDepotOperator>().Cast<IOperator>(); … … 95 93 public override double[] GetCoordinates(int city) { 96 94 double[] coordinates; 97 95 98 96 if (city == 0) { 99 97 //calculate centroid … … 119 117 public int GetDepot(int customer, IVRPEncoding solution) { 120 118 int depot = -1; 121 119 122 120 Tour tour = 123 121 solution.GetTours().FirstOrDefault(t => t.Stops.Contains(customer)); … … 135 133 if (start == 0 && end == 0) 136 134 return 0; 137 135 138 136 if (start == 0) { 139 137 start = GetDepot(end, solution); … … 146 144 end += Depots.Value - 1; 147 145 } 148 146 149 147 return base.GetDistance(start, end, solution); 150 148 } 151 149 152 public override double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution, 150 public override double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution, 153 151 out double startDistance, out double endDistance) { 154 152 if (start == 0) { … … 163 161 } 164 162 customer += Depots.Value - 1; 165 163 166 164 double distance = base.GetDistance(start, end, solution); 167 165 … … 173 171 return newDistance - distance; 174 172 } 175 173 176 174 [StorableConstructor] 177 175 protected MultiDepotVRPProblemInstance(bool deserializing) : base(deserializing) { }
Note: See TracChangeset
for help on using the changeset viewer.