Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8775


Ignore:
Timestamp:
10/10/12 11:45:31 (11 years ago)
Author:
ascheibe
Message:

#1331 added Scatter Search sample

Location:
trunk/sources
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r8600 r8775  
    125125    <EmbeddedResource Include="Documents\PSO_Schwefel.hl" />
    126126    <EmbeddedResource Include="Documents\TS_VRP.hl" />
     127    <EmbeddedResource Include="Documents\SS_VRP.hl" />
    127128    <None Include="Plugin.cs.frame" />
    128129    <Compile Include="DefineArithmeticProgressionDialog.cs">
     
    340341  -->
    341342  <PropertyGroup>
    342    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     343    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    343344set ProjectDir=$(ProjectDir)
    344345set SolutionDir=$(SolutionDir)
     
    347348call PreBuildEvent.cmd
    348349</PreBuildEvent>
    349 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     350    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    350351export ProjectDir=$(ProjectDir)
    351352export SolutionDir=$(SolutionDir)
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/SamplesTest.cs

    r8740 r8775  
    2828using HeuristicLab.Algorithms.LocalSearch;
    2929using HeuristicLab.Algorithms.ParticleSwarmOptimization;
     30using HeuristicLab.Algorithms.ScatterSearch;
    3031using HeuristicLab.Algorithms.SimulatedAnnealing;
    3132using HeuristicLab.Algorithms.TabuSearch;
     
    5758using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    5859using HeuristicLab.Selection;
     60using HeuristicLab.SequentialEngine;
    5961using Microsoft.VisualStudio.TestTools.UnitTesting;
    6062
     
    950952    #endregion
    951953
     954    #region Scatter Search
     955    #region VRP
     956    [TestMethod]
     957    public void CreateScatterSearchVRPSampleTest() {
     958      var ss = CreateScatterSearchVRPSample();
     959      XmlGenerator.Serialize(ss, "../../SS_VRP.hl");
     960    }
     961
     962    [TestMethod]
     963    public void RunScatterSearchVRPSampleTest() {
     964      var ss = CreateScatterSearchVRPSample();
     965      ss.SetSeedRandomly.Value = false;
     966      RunAlgorithm(ss);
     967      Assert.AreEqual(749, GetDoubleResult(ss, "BestQuality"));
     968      Assert.AreEqual(766.95, GetDoubleResult(ss, "CurrentAverageQuality"));
     969      Assert.AreEqual(789, GetDoubleResult(ss, "CurrentWorstQuality"));
     970      Assert.AreEqual(27400, GetIntResult(ss, "EvaluatedSolutions"));
     971    }
     972
     973    private ScatterSearch CreateScatterSearchVRPSample() {
     974      #region Problem Configuration
     975      var provider = new AugeratInstanceProvider();
     976      var instance = provider.GetDataDescriptors().Where(x => x.Name == "A-n38-k5").Single();
     977      VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem();
     978      vrpProblem.Load(provider.LoadData(instance));
     979      #endregion
     980
     981      #region Algorithm Configuration
     982      ScatterSearch ss = new ScatterSearch();
     983      ss.Engine = new SequentialEngine();
     984      ss.Name = "Scatter Search - VRP";
     985      ss.Description = "A Scatter Search algorithm which solves the \"A-n38-k5\" vehicle routing problem (imported from Augerat)";
     986      ss.Problem = vrpProblem;
     987
     988      var improver = ss.Problem.Operators.OfType<VRPImprovementOperator>().First();
     989      improver.ImprovementAttemptsParameter.Value.Value = 5;
     990      improver.SampleSizeParameter.Value.Value = 5;
     991      ss.Improver = improver;
     992
     993      var pathRelinker = ss.Problem.Operators.OfType<VRPPathRelinker>().First();
     994      pathRelinker.IterationsParameter.Value.Value = 15;
     995      ss.PathRelinker = pathRelinker;
     996
     997      var qualitySimCalc = ss.SimilarityCalculatorParameter.ValidValues.OfType<QualitySimilarityCalculator>().First();
     998      ss.SimilarityCalculator = qualitySimCalc;
     999
     1000      ss.MaximumIterations.Value = 5;
     1001      ss.Seed.Value = 0;
     1002      return ss;
     1003      #endregion
     1004    }
     1005    #endregion
     1006    #endregion
     1007
    9521008    #region Helpers
    9531009    private void ConfigureEvolutionStrategyParameters<R, M, SC, SR, SM>(EvolutionStrategy es, int popSize, int children, int parentsPerChild, int maxGens, bool plusSelection)
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r8757 r8775  
    119119    <Reference Include="HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    120120      <HintPath>..\bin\HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.dll</HintPath>
     121    </Reference>
     122    <Reference Include="HeuristicLab.Algorithms.RAPGA-3.3">
     123      <HintPath>..\bin\HeuristicLab.Algorithms.RAPGA-3.3.dll</HintPath>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Algorithms.ScatterSearch-3.3">
     126      <HintPath>..\bin\HeuristicLab.Algorithms.ScatterSearch-3.3.dll</HintPath>
    121127    </Reference>
    122128    <Reference Include="HeuristicLab.Algorithms.SimulatedAnnealing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
Note: See TracChangeset for help on using the changeset viewer.