Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/24/12 15:02:07 (12 years ago)
Author:
svonolfe
Message:

VRP 3.4 trunk integration (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs

    r7863 r7900  
    5151using HeuristicLab.Problems.VehicleRouting;
    5252using HeuristicLab.Problems.VehicleRouting.Encodings.General;
     53using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
    5354using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
     55using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    5456using HeuristicLab.Selection;
    5557using Microsoft.VisualStudio.TestTools.UnitTesting;
     58using HeuristicLab.Problems.Instances.VehicleRouting;
     59using HeuristicLab.Problems.Instances;
     60
    5661
    5762namespace HeuristicLab_33.Tests {
     
    116121      ga.SetSeedRandomly.Value = false;
    117122      RunAlgorithm(ga);
    118       Assert.AreEqual(1828.9368669428336, GetDoubleResult(ga, "BestQuality"));
    119       Assert.AreEqual(1831.5504074358635, GetDoubleResult(ga, "CurrentAverageQuality"));
    120       Assert.AreEqual(1895.8980772167054, GetDoubleResult(ga, "CurrentWorstQuality"));
     123      Assert.AreEqual(1828.9368669428338, GetDoubleResult(ga, "BestQuality"));
     124      Assert.AreEqual(1830.1444308908331, GetDoubleResult(ga, "CurrentAverageQuality"));
     125      Assert.AreEqual(1871.7128510304112, GetDoubleResult(ga, "CurrentWorstQuality"));
    121126      Assert.AreEqual(99100, GetIntResult(ga, "EvaluatedSolutions"));
    122127    }
     
    127132      VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem();
    128133
    129       vrpProblem.ImportFromSolomon("C101.txt");
    130       vrpProblem.ImportSolution("C101.opt.txt");
     134      SolomonFormatInstanceProvider instanceProvider = new SolomonInstanceProvider();
     135      IVRPData data = instanceProvider.LoadData("C101.txt", "C101.opt.txt");
     136      vrpProblem.Load(data);
    131137      vrpProblem.Name = "C101 VRP (imported from Solomon)";
    132138      vrpProblem.Description = "Represents a Vehicle Routing Problem.";
    133       vrpProblem.DistanceFactorParameter.Value.Value = 1;
    134       vrpProblem.FleetUsageFactorParameter.Value.Value = 100;
    135       vrpProblem.OverloadPenaltyParameter.Value.Value = 100;
    136       vrpProblem.TardinessPenaltyParameter.Value.Value = 100;
    137       vrpProblem.TimeFactorParameter.Value.Value = 0;
    138       vrpProblem.EvaluatorParameter.Value = new VRPEvaluator();
     139      CVRPTWProblemInstance instance = vrpProblem.ProblemInstance as CVRPTWProblemInstance;
     140      instance.DistanceFactor.Value = 1;
     141      instance.FleetUsageFactor.Value = 100;
     142      instance.OverloadPenalty.Value = 100;
     143      instance.TardinessPenalty.Value = 100;
     144      instance.TimeFactor.Value = 0;
    139145      vrpProblem.MaximizationParameter.Value.Value = false;
    140       vrpProblem.SolutionCreatorParameter.Value = new RandomCreator();
    141       vrpProblem.UseDistanceMatrix.Value = true;
    142       vrpProblem.Vehicles.Value = 25;
     146      instance.UseDistanceMatrix.Value = true;
     147      instance.Vehicles.Value = 25;
    143148      #endregion
    144149      #region Algorithm Configuration
     
    950955      ga.Selector = ga.SelectorParameter.ValidValues
    951956        .OfType<S>()
    952         .Single();
     957        .First();
    953958
    954959      ga.Crossover = ga.CrossoverParameter.ValidValues
    955960        .OfType<C>()
    956         .Single();
     961        .First();
    957962
    958963      ga.Mutator = ga.MutatorParameter.ValidValues
    959964        .OfType<M>()
    960         .Single();
     965        .First();
    961966
    962967      var tSelector = ga.Selector as TournamentSelector;
Note: See TracChangeset for help on using the changeset viewer.