Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/17 23:19:44 (7 years ago)
Author:
abeham
Message:

#1614:

  • distributed code from artificial common plugin
  • removed common plugin
Location:
branches/GeneralizedQAP
Files:
1 deleted
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/GeneralizedQAP.sln

    r15491 r15492  
    99EndProject
    1010Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.GRASP-3.3", "HeuristicLab.Algorithms.GRASP\3.3\HeuristicLab.Algorithms.GRASP-3.3.csproj", "{53AB48BF-532F-417D-B98B-745105BB447A}"
    11 EndProject
    12 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3", "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj", "{DA367BE5-4F53-4243-933B-32AAB86189D5}"
    1311EndProject
    1412Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{68C6C157-08DA-414F-9256-CCCA13038399}"
     
    6664    {53AB48BF-532F-417D-B98B-745105BB447A}.Release|x86.ActiveCfg = Release|Any CPU
    6765    {53AB48BF-532F-417D-B98B-745105BB447A}.Release|x86.Build.0 = Release|Any CPU
    68     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    69     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
    70     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|x64.ActiveCfg = Debug|Any CPU
    71     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|x64.Build.0 = Debug|Any CPU
    72     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|x86.ActiveCfg = Debug|Any CPU
    73     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Debug|x86.Build.0 = Debug|Any CPU
    74     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
    75     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|Any CPU.Build.0 = Release|Any CPU
    76     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|x64.ActiveCfg = Release|Any CPU
    77     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|x64.Build.0 = Release|Any CPU
    78     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|x86.ActiveCfg = Release|Any CPU
    79     {DA367BE5-4F53-4243-933B-32AAB86189D5}.Release|x86.Build.0 = Release|Any CPU
    8066    {68C6C157-08DA-414F-9256-CCCA13038399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    8167    {68C6C157-08DA-414F-9256-CCCA13038399}.Debug|Any CPU.Build.0 = Debug|Any CPU
  • branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/GRASPWithPathRelinking.cs

    r15490 r15492  
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3232using HeuristicLab.PluginInfrastructure;
    33 using HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common;
    3433using HeuristicLab.Random;
    3534
  • branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/GRASPWithPathRelinkingMainLoop.cs

    r15490 r15492  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using HeuristicLab.Common;
     
    3031using HeuristicLab.Parameters;
    3132using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    32 using HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common;
    3333using HeuristicLab.Selection;
    3434
     
    196196
    197197    private void Parameterize() {
    198       var operators = OperatorGraph.InitialOperator.Walk().ToArray();
     198      var operators = Walk(OperatorGraph).ToArray();
    199199
    200200      foreach (var solutionsCreator in operators.OfType<SolutionsCreator>()) {
    201201        solutionsCreator.SolutionCreatorParameter.ActualName = SolutionCreatorParameter.Name;
    202202        solutionsCreator.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
     203      }
     204    }
     205
     206    /// <summary>
     207    /// Walks an operator graph in that it jumps from one operator to all its operator parameters and yields each operator it touches.
     208    /// Cycles are detected and not walked twice.
     209    /// </summary>
     210    /// <param name="graph">The operator graph that should be walked.</param>
     211    /// <returns>An enumeration of all the operators that could be found.</returns>
     212    private IEnumerable<IOperator> Walk(OperatorGraph graph) {
     213      var open = new Stack<IOperator>();
     214      var visited = new HashSet<IOperator>();
     215      open.Push(graph.InitialOperator);
     216
     217      while (open.Any()) {
     218        IOperator current = open.Pop();
     219        if (visited.Contains(current)) continue;
     220        visited.Add(current);
     221        yield return current;
     222
     223        foreach (var parameter in current.Parameters.OfType<IValueParameter>()) {
     224          if (typeof(IOperator).IsAssignableFrom(parameter.DataType)) {
     225            if (parameter.Value != null)
     226              open.Push((IOperator)parameter.Value);
     227          }
     228        }
     229        var algOp = current as AlgorithmOperator;
     230        if (algOp != null && algOp.OperatorGraph.InitialOperator != null) {
     231          open.Push(algOp.OperatorGraph.InitialOperator);
     232        }
    203233      }
    204234    }
  • branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/HeuristicLab.Algorithms.GRASP-3.3.csproj

    r15490 r15492  
    110110      <Private>False</Private>
    111111    </ProjectReference>
    112     <ProjectReference Include="..\..\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj">
    113       <Project>{DA367BE5-4F53-4243-933B-32AAB86189D5}</Project>
    114       <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3</Name>
    115       <Private>False</Private>
    116     </ProjectReference>
    117112  </ItemGroup>
    118113  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/GeneralizedQAP/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorEqualityComparer.cs

    r15162 r15492  
    4545      }
    4646    }
     47
     48    public static IEnumerable<int> GetDifferingIndices(IntegerVector a, IntegerVector b) {
     49      if (a == null || b == null) throw new ArgumentNullException("arguments must not be null");
     50      for (int i = 0; i < a.Length; i++)
     51        if (a[i] != b[i]) yield return i;
     52    }
    4753  }
    4854}
  • branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r15490 r15492  
    156156    <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" />
    157157    <Compile Include="Interfaces\IMultiObjectiveOperator.cs" />
     158    <Compile Include="Interfaces\IPopulationReducer.cs" />
    158159    <Compile Include="MultiObjective\DominationCalculator.cs" />
    159160    <Compile Include="Results\IResultParameter.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/Interfaces/IPopulationReducer.cs

    r15454 r15492  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.Core;
    2323using HeuristicLab.Data;
    24 using HeuristicLab.Optimization;
    2524
    26 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common {
     25namespace HeuristicLab.Optimization {
    2726  public interface IPopulationReducer : IReducer {
    2827    ILookupParameter<IntValue> MinimumPopulationSizeParameter { get; }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj

    r15491 r15492  
    186186      <Private>False</Private>
    187187    </ProjectReference>
    188     <ProjectReference Include="..\..\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj">
    189       <Project>{DA367BE5-4F53-4243-933B-32AAB86189D5}</Project>
    190       <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3</Name>
    191       <Private>False</Private>
    192     </ProjectReference>
    193188  </ItemGroup>
    194189  <ItemGroup />
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/GQAPPathRelinking.cs

    r15490 r15492  
    137137      var fix = new HashSet<int>();
    138138      var nonFix = new HashSet<int>(Enumerable.Range(0, demands.Length));
    139       var phi = new HashSet<int>((pi_prime.GetDifferingIndices(target)));
     139      var phi = new HashSet<int>((IntegerVectorEqualityComparer.GetDifferingIndices(pi_prime, target)));
    140140
    141141      while (phi.Any()) {
     
    176176              bool contains = false;
    177177              foreach (var b in B) {
    178                 if (!solution.Assignment.GetDifferingIndices(b.Assignment).Any()) {
     178                if (!IntegerVectorEqualityComparer.GetDifferingIndices(solution.Assignment, b.Assignment).Any()) {
    179179                  contains = true;
    180180                  break;
     
    189189          if (maximization.Value) pi = B.SampleProportional(random, 1, B.Select(x => x.Quality.Value), false).First();
    190190          else pi = B.SampleProportional(random, 1, B.Select(x => 1.0 / x.Quality.Value), false).First();
    191           var diff = pi.Assignment.GetDifferingIndices(target);
     191          var diff = IntegerVectorEqualityComparer.GetDifferingIndices(pi.Assignment, target);
    192192          var I = phi.Except(diff);
    193193          var i = I.SampleRandom(random);
     
    203203          }
    204204        } else return result;
    205         phi = new HashSet<int>(pi_prime.GetDifferingIndices(target));
     205        phi = new HashSet<int>(IntegerVectorEqualityComparer.GetDifferingIndices(pi_prime, target));
    206206      }
    207207
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/PopulationReducers/GQAPQualitySimilarityReducer.cs

    r15490 r15492  
    2727using HeuristicLab.Encodings.IntegerVectorEncoding;
    2828using HeuristicLab.Operators;
     29using HeuristicLab.Optimization;
    2930using HeuristicLab.Parameters;
    3031using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common;
    3232
    3333namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Operators {
  • branches/GeneralizedQAP/UnitTests/UnitTests.csproj

    r15490 r15492  
    115115      <Name>HeuristicLab.Optimization-3.3</Name>
    116116    </ProjectReference>
    117     <ProjectReference Include="..\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj">
    118       <Project>{DA367BE5-4F53-4243-933B-32AAB86189D5}</Project>
    119       <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3</Name>
    120     </ProjectReference>
    121117    <ProjectReference Include="..\HeuristicLab.Problems.GeneralizedQuadraticAssignment\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj">
    122118      <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project>
Note: See TracChangeset for help on using the changeset viewer.