Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7881


Ignore:
Timestamp:
05/23/12 17:32:07 (12 years ago)
Author:
svonolfe
Message:

Added VRP test instances (#1177)

Location:
branches/VRP
Files:
47 added
1 deleted
4 edited

Legend:

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

    r7871 r7881  
    192192    <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarSingleMoveGenerator.cs" />
    193193    <Compile Include="Interfaces\IVRPLocalSearchManipulator.cs" />
     194    <Compile Include="Interpreters\MDCVRPTWInterpreter.cs" />
     195    <Compile Include="Interpreters\PDPTWInterpreter.cs" />
     196    <Compile Include="Interpreters\CVRPTWInterpreter.cs" />
    194197    <Compile Include="Interpreters\CVRPInterpreter.cs" />
    195198    <Compile Include="Interpreters\IVRPDataInterpreter.cs" />
     
    372375    <Compile Include="Interfaces\IVRPEncoding.cs" />
    373376    <Compile Include="Interfaces\IVRPProblemInstance.cs" />
    374     <Compile Include="Parsers\CordeauParser.cs" />
    375     <Compile Include="Parsers\LiLimParser.cs" />
    376377    <Compile Include="Plugin.cs" />
    377378    <Compile Include="ProblemInstances\MultiDepotVRP\MDCVRP\MDCVRPEvaluator.cs" />
     
    403404    <Compile Include="Variants\TimeWindowed\ITimeWindowedProblemInstance.cs" />
    404405    <Compile Include="Variants\TimeWindowed\ITimeWindowedOperator.cs" />
    405     <Compile Include="Parsers\ORLIBParser.cs" />
    406406    <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPTWProblemInstance.cs" />
    407407    <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPProblemInstance.cs" />
     
    415415    <Compile Include="ProblemInstances\VRPProblemInstance.cs" />
    416416    <Compile Include="Encodings\Tour.cs" />
    417     <Compile Include="Parsers\TSPLIBParser.cs" />
    418     <Compile Include="Parsers\SolomonParser.cs" />
    419417    <Compile Include="VehicleRoutingProblem.cs" />
    420418  </ItemGroup>
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPInterpreter.cs

    r7871 r7881  
    4040
    4141      CVRPProblemInstance problem = new CVRPProblemInstance();
    42       problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
     42      if(cvrpData.Coordinates != null)
     43        problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
    4344      if (cvrpData.MaximumVehicles != null)
    4445        problem.Vehicles.Value = (int)cvrpData.MaximumVehicles;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs

    r7871 r7881  
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Problems.VehicleRouting.Interfaces;
    35 using HeuristicLab.Problems.VehicleRouting.Parsers;
    3635using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    3736using HeuristicLab.Problems.VehicleRouting.Variants;
     
    194193      if (ProblemInstance != null) {
    195194        EvaluatorParameter.Value = ProblemInstance.SolutionEvaluator;
     195        IVRPCreator defaultCreator = null;
    196196        foreach (IVRPCreator creator in operators.Where(o => o is IVRPCreator)) {
    197197          solutionCreatorParameter.ValidValues.Add(creator);
    198         }
     198          if (creator is Encodings.Alba.RandomCreator)
     199            defaultCreator = creator;
     200        }
     201        if (defaultCreator != null)
     202          solutionCreatorParameter.Value = defaultCreator;
     203
    199204        ProblemInstance.EvaluationChanged += new EventHandler(ProblemInstance_EvaluationChanged);
    200205      }     
     
    275280    }
    276281    #endregion
    277 
    278     public void ImportFromCordeau(string cordeauFileName) {
    279       CordeauParser parser = new CordeauParser(cordeauFileName);
    280       parser.Parse();
    281 
    282       this.Name = parser.ProblemName;
    283       MDCVRPTWProblemInstance problem = new MDCVRPTWProblemInstance();
    284 
    285       problem.Coordinates = new DoubleMatrix(parser.Coordinates);
    286       problem.Vehicles.Value = parser.Vehicles;
    287       problem.Capacity = new DoubleArray(parser.Capacity);
    288       problem.Demand = new DoubleArray(parser.Demands);
    289       problem.Depots.Value = parser.Depots;
    290       problem.VehicleDepotAssignment = new IntArray(parser.Vehicles);
    291       problem.ReadyTime = new DoubleArray(parser.Readytimes);
    292       problem.ServiceTime = new DoubleArray(parser.Servicetimes);
    293       problem.DueTime = new DoubleArray(parser.Duetimes);
    294 
    295       int depot = 0;
    296       int i = 0;
    297       while(i < parser.Vehicles) {
    298         problem.VehicleDepotAssignment[i] = depot;
    299 
    300         i++;
    301         if (i % (parser.Vehicles / parser.Depots) == 0)
    302           depot++;
    303       }
    304 
    305       this.ProblemInstance = problem;
    306 
    307       OnReset();
    308     }
    309 
    310     public void ImportFromLiLim(string liLimFileName) {
    311       LiLimParser parser = new LiLimParser(liLimFileName);
    312       parser.Parse();
    313 
    314       this.Name = parser.ProblemName;
    315       CVRPPDTWProblemInstance problem = new CVRPPDTWProblemInstance();
    316 
    317       problem.Coordinates = new DoubleMatrix(parser.Coordinates);
    318       problem.Vehicles.Value = parser.Vehicles;
    319       problem.Capacity.Value = parser.Capacity;
    320       problem.Demand = new DoubleArray(parser.Demands);
    321       problem.ReadyTime = new DoubleArray(parser.Readytimes);
    322       problem.DueTime = new DoubleArray(parser.Duetimes);
    323       problem.ServiceTime = new DoubleArray(parser.Servicetimes);
    324       problem.PickupDeliveryLocation = new IntArray(parser.PickupDeliveryLocations);
    325 
    326       this.ProblemInstance = problem;
    327 
    328       OnReset();
    329     }
    330 
    331     public void ImportFromSolomon(string solomonFileName) {
    332       SolomonParser parser = new SolomonParser(solomonFileName);
    333       parser.Parse();
    334 
    335       this.Name = parser.ProblemName;
    336       CVRPTWProblemInstance problem = new CVRPTWProblemInstance();
    337      
    338       problem.Coordinates = new DoubleMatrix(parser.Coordinates);
    339       problem.Vehicles.Value = parser.Vehicles;
    340       problem.Capacity.Value = parser.Capacity;
    341       problem.Demand = new DoubleArray(parser.Demands);
    342       problem.ReadyTime = new DoubleArray(parser.Readytimes);
    343       problem.DueTime = new DoubleArray(parser.Duetimes);
    344       problem.ServiceTime = new DoubleArray(parser.Servicetimes);
    345 
    346       this.ProblemInstance = problem;
    347 
    348       OnReset();
    349     }
    350 
    351     public void ImportFromTSPLib(string tspFileName) {
    352       TSPLIBParser parser = new TSPLIBParser(tspFileName);
    353       parser.Parse();
    354 
    355       this.Name = parser.Name;
    356       int problemSize = parser.Demands.Length;
    357 
    358       if (parser.Depot != 1) {
    359         ErrorHandling.ShowErrorDialog(new Exception("Invalid depot specification"));
    360         return;
    361       }
    362 
    363       if (parser.WeightType != TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D)  {
    364         ErrorHandling.ShowErrorDialog(new Exception("Invalid weight type"));
    365         return;
    366       }
    367 
    368       CVRPTWProblemInstance problem = new CVRPTWProblemInstance();
    369       problem.Coordinates = new DoubleMatrix(parser.Vertices);
    370       if (parser.Vehicles != -1)
    371         problem.Vehicles.Value = parser.Vehicles;
    372       else
    373         problem.Vehicles.Value = problemSize - 1;
    374       problem.Capacity.Value = parser.Capacity;
    375       problem.Demand = new DoubleArray(parser.Demands);
    376       problem.ReadyTime = new DoubleArray(problemSize);
    377       problem.DueTime = new DoubleArray(problemSize);
    378       problem.ServiceTime = new DoubleArray(problemSize);
    379 
    380       for (int i = 0; i < problemSize; i++) {
    381         problem.ReadyTime[i] = 0;
    382         problem.DueTime[i] = int.MaxValue;
    383         problem.ServiceTime[i] = 0;
    384       }
    385 
    386       if (parser.Distance != -1) {
    387         problem.DueTime[0] = parser.Distance;
    388       }
    389 
    390       this.ProblemInstance = problem;
    391 
    392       OnReset();
    393     }
    394 
    395     public void ImportFromORLib(string orFileName) {
    396       ORLIBParser parser = new ORLIBParser(orFileName);
    397       parser.Parse();
    398 
    399       this.Name = parser.Name;
    400       int problemSize = parser.Demands.Length;
    401 
    402       CVRPProblemInstance problem = new CVRPProblemInstance();
    403 
    404       problem.Coordinates = new DoubleMatrix(parser.Vertices);
    405       problem.Vehicles.Value = problemSize - 1;
    406       problem.Capacity.Value = parser.Capacity;
    407       problem.Demand = new DoubleArray(parser.Demands);
    408 
    409       this.ProblemInstance = problem;
    410 
    411       OnReset();
    412     }
    413282
    414283    private void InitializeRandomVRPInstance() {
     
    482351
    483352        OnReset();
     353        BestKnownQuality = null;
     354        BestKnownSolution = null;
    484355
    485356        if (instance.BestKnownQuality != null) {
     
    489360        if (instance.BestKnownSolution != null) {
    490361          VRPSolution solution = new VRPSolution(ProblemInstance, instance.BestKnownSolution, new DoubleValue(0));
    491           BestKnownSolutionParameter.Value = solution;
     362          BestKnownSolution = solution;
    492363        }
    493364      } else {
  • branches/VRP/HeuristicLab.VRP.sln

    r7088 r7881  
    1111EndProject
    1212Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.VehicleRouting.Views-3.4", "HeuristicLab.Problems.VehicleRouting.Views\3.4\HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj", "{7EA0985E-A1D6-4FA7-B30A-2633FDFB01F0}"
     13EndProject
     14Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.VehicleRouting-3.4", "HeuristicLab.Problems.Instances.VehicleRouting\3.4\HeuristicLab.Problems.Instances.VehicleRouting-3.4.csproj", "{CE0F99D6-1C56-48A9-9B68-3E5B833703EF}"
     15EndProject
     16Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.VehicleRouting.Views-3.4", "HeuristicLab.Problems.Instances.VehicleRouting.Views\3.4\HeuristicLab.Problems.Instances.VehicleRouting.Views-3.4.csproj", "{B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}"
    1317EndProject
    1418Global
     
    4650    {7EA0985E-A1D6-4FA7-B30A-2633FDFB01F0}.Release|x86.ActiveCfg = Release|x86
    4751    {7EA0985E-A1D6-4FA7-B30A-2633FDFB01F0}.Release|x86.Build.0 = Release|x86
     52    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     53    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
     54    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|x64.ActiveCfg = Debug|x64
     55    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|x64.Build.0 = Debug|x64
     56    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|x86.ActiveCfg = Debug|x86
     57    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Debug|x86.Build.0 = Debug|x86
     58    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
     59    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|Any CPU.Build.0 = Release|Any CPU
     60    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x64.ActiveCfg = Release|x64
     61    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x64.Build.0 = Release|x64
     62    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x86.ActiveCfg = Release|x86
     63    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x86.Build.0 = Release|x86
     64    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     65    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
     66    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|x64.ActiveCfg = Debug|x64
     67    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|x64.Build.0 = Debug|x64
     68    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|x86.ActiveCfg = Debug|x86
     69    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Debug|x86.Build.0 = Debug|x86
     70    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
     71    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|Any CPU.Build.0 = Release|Any CPU
     72    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|x64.ActiveCfg = Release|x64
     73    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|x64.Build.0 = Release|x64
     74    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|x86.ActiveCfg = Release|x86
     75    {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9}.Release|x86.Build.0 = Release|x86
    4876  EndGlobalSection
    4977  GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.