Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16814


Ignore:
Timestamp:
04/18/19 13:42:12 (6 years ago)
Author:
mkommend
Message:

#2521: Adapted binary problems and moved to abstract base class to encoding.

Location:
branches/2521_ProblemRefactoring
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorProblem.cs

    r16805 r16814  
    2424using System;
    2525using System.Linq;
     26using HEAL.Attic;
    2627using HeuristicLab.Analysis;
    2728using HeuristicLab.Common;
    2829using HeuristicLab.Core;
    2930using HeuristicLab.Data;
    30 using HeuristicLab.Encodings.BinaryVectorEncoding;
    3131using HeuristicLab.Optimization;
    3232using HeuristicLab.Optimization.Operators;
    3333using HeuristicLab.Parameters;
    34 using HEAL.Attic;
    3534
    36 namespace HeuristicLab.Problems.Binary {
     35namespace HeuristicLab.Encodings.BinaryVectorEncoding {
    3736  [StorableType("2F6FEB34-BD19-47AF-9484-7F48565C0C43")]
    38   public abstract class BinaryProblem : SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> {
    39     public virtual int Length {
     37  public abstract class BinaryVectorProblem : SingleObjectiveProblem<BinaryVectorEncoding, BinaryVector> {
     38    public int Length {
    4039      get { return Encoding.Length; }
    4140      set { Encoding.Length = value; }
     
    4746
    4847    [StorableConstructor]
    49     protected BinaryProblem(StorableConstructorFlag _) : base(_) { }
     48    protected BinaryVectorProblem(StorableConstructorFlag _) : base(_) { }
    5049    [StorableHook(HookType.AfterDeserialization)]
    5150    private void AfterDeserialization() {
     
    5352    }
    5453
    55     protected BinaryProblem(BinaryProblem original, Cloner cloner)
     54    protected BinaryVectorProblem(BinaryVectorProblem original, Cloner cloner)
    5655      : base(original, cloner) {
    5756      RegisterEventHandlers();
    5857    }
    5958
    60     protected BinaryProblem()
    61       : base() {
     59    protected BinaryVectorProblem() : base(new BinaryVectorEncoding()) {
    6260      var lengthParameter = new FixedValueParameter<IntValue>("Length", "The length of the BinaryVector.", new IntValue(10));
    6361      Parameters.Add(lengthParameter);
    6462      Encoding.LengthParameter = lengthParameter;
     63
    6564      Operators.Add(new HammingSimilarityCalculator());
    6665      Operators.Add(new QualitySimilarityCalculator());
    6766      Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
     67
    6868      Parameterize();
    6969      RegisterEventHandlers();
     
    8989    private void Parameterize() {
    9090      foreach (var similarityCalculator in Operators.OfType<ISolutionSimilarityCalculator>()) {
    91         // TODO: BinaryVectorParameter is no more part of ISolutionCreator<BinaryVector>
    92         similarityCalculator.SolutionVariableName = ((IBinaryVectorSolutionOperator)Encoding.SolutionCreator).BinaryVectorParameter.ActualName;
     91        similarityCalculator.SolutionVariableName = Encoding.Name;
    9392        similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName;
    9493      }
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj

    r16723 r16814  
    119119  </ItemGroup>
    120120  <ItemGroup>
     121    <Compile Include="BinaryVectorProblem.cs" />
    121122    <Compile Include="BinaryVectorEncoding.cs" />
    122123    <Compile Include="BinaryVectorEqualityComparer.cs" />
     
    158159  </ItemGroup>
    159160  <ItemGroup>
     161    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
     162      <Project>{887425b4-4348-49ed-a457-b7d2c26ddbf9}</Project>
     163      <Name>HeuristicLab.Analysis-3.3</Name>
     164      <Private>False</Private>
     165    </ProjectReference>
    160166    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    161167      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/DeceptiveStepTrapProblem.cs

    r16723 r16814  
    2222#endregion
    2323
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    2728using HeuristicLab.Encodings.BinaryVectorEncoding;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.Binary {
     
    5555    }
    5656
    57     public DeceptiveStepTrapProblem()
    58       : base() {
     57    public DeceptiveStepTrapProblem() : base() {
    5958      Parameters.Add(new FixedValueParameter<IntValue>(StepSizeParameterName, "", new IntValue(2)));
    6059      RegisterParameterEvents();
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/DeceptiveTrapProblem.cs

    r16723 r16814  
    2323
    2424using System;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    2829using HeuristicLab.Encodings.BinaryVectorEncoding;
    2930using HeuristicLab.Parameters;
    30 using HEAL.Attic;
    3131
    3232namespace HeuristicLab.Problems.Binary {
     
    3434  [StorableType("399FFE01-2B76-4DBF-B363-8BB65FE95A5D")]
    3535  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 230)]
    36   public class DeceptiveTrapProblem : BinaryProblem {
     36  public class DeceptiveTrapProblem : BinaryVectorProblem {
    3737    [StorableConstructor]
    3838    protected DeceptiveTrapProblem(StorableConstructorFlag _) : base(_) { }
     
    6363    }
    6464
    65     public DeceptiveTrapProblem()
    66       : base() {
     65    public DeceptiveTrapProblem() : base() {
    6766      Parameters.Add(new FixedValueParameter<IntValue>(TrapSizeParameterName, "", new IntValue(7)));
    6867      Encoding.Length = 49;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/HIFFProblem.cs

    r16723 r16814  
    2323
    2424using System;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Encodings.BinaryVectorEncoding;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.Binary {
     
    3232  [StorableType("8AC6D94E-E7B4-4216-B2CA-8E142E7A1391")]
    3333  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 220)]
    34   public class HIFFProblem : BinaryProblem {
     34  public class HIFFProblem : BinaryVectorProblem {
    3535    [StorableConstructor]
    3636    protected HIFFProblem(StorableConstructorFlag _) : base(_) { }
     
    4646    }
    4747
    48     public HIFFProblem()
    49       : base() {
     48    public HIFFProblem() : base() {
    5049      Encoding.Length = 64;
    5150    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj

    r16723 r16814  
    8383  </ItemGroup>
    8484  <ItemGroup>
    85     <Compile Include="BinaryProblem.cs" />
    8685    <Compile Include="DeceptiveStepTrapProblem.cs" />
    8786    <Compile Include="DeceptiveTrapProblem.cs" />
     
    9796  </ItemGroup>
    9897  <ItemGroup>
    99     <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    100       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    101       <Name>HeuristicLab.Analysis-3.3</Name>
    102       <Private>False</Private>
    103     </ProjectReference>
    10498    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    10599      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    106100      <Name>HeuristicLab.Collections-3.3</Name>
    107       <Private>False</Private>
    108101    </ProjectReference>
    109102    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
     
    127120      <Private>False</Private>
    128121    </ProjectReference>
    129     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    130       <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
    131       <Name>HeuristicLab.Operators-3.3</Name>
    132       <Private>False</Private>
    133     </ProjectReference>
    134     <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
    135       <Project>{25087811-f74c-4128-bc86-8324271da13e}</Project>
    136       <Name>HeuristicLab.Optimization.Operators-3.3</Name>
    137       <Private>False</Private>
    138     </ProjectReference>
    139122    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    140123      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    141124      <Name>HeuristicLab.Optimization-3.3</Name>
    142       <Private>False</Private>
    143125    </ProjectReference>
    144126    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    145127      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
    146128      <Name>HeuristicLab.Parameters-3.3</Name>
    147       <Private>False</Private>
    148     </ProjectReference>
    149     <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
    150       <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>
    151       <Name>HeuristicLab.Persistence-3.3</Name>
    152129      <Private>False</Private>
    153130    </ProjectReference>
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/OneMaxProblem.cs

    r16723 r16814  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Encodings.BinaryVectorEncoding;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.Binary {
     
    3131  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 210)]
    3232  [StorableType("A290ADDE-33F5-4607-ABC0-19349CD0FBF1")]
    33   public class OneMaxProblem : BinaryProblem {
     33  public class OneMaxProblem : BinaryVectorProblem {
    3434    public override bool Maximization {
    3535      get { return true; }
    3636    }
    3737
    38     public OneMaxProblem()
    39       : base() {
     38    public OneMaxProblem() : base() {
    4039      Encoding.Length = 10;
    4140      BestKnownQuality = Encoding.Length;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/Plugin.cs.frame

    r16723 r16814  
    2828  [Plugin("HeuristicLab.Problems.Binary","Provides binary benchmark problems.", "3.3.15.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.Binary-3.3.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.Analysis", "3.3")]
    3130  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3231  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3534  [PluginDependency("HeuristicLab.Encodings.BinaryVectorEncoding", "3.3")]
    3635  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    37   [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
    3836  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3937  [PluginDependency("HeuristicLab.Attic", "1.0")]
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.NK/3.3/NKLandscape.cs

    r16723 r16814  
    3737  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 215)]
    3838  [StorableType("04294537-87F2-4A9F-BC14-7D4CA700F326")]
    39   public sealed class NKLandscape : BinaryProblem {
     39  public sealed class NKLandscape : BinaryVectorProblem {
    4040    public override bool Maximization {
    4141      get { return false; }
Note: See TracChangeset for help on using the changeset viewer.