Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/12/15 15:39:28 (9 years ago)
Author:
abeham
Message:

#2282:

  • Renamed BinaryVectorProblem to BinaryProblem
  • Removed IBinaryVectorProblem interface
  • Derived BinaryProblem from SingleObjectiveBasicProblem
  • Changed bool[] datatype to BinaryVector
Location:
trunk/sources/HeuristicLab.Problems.Binary
Files:
3 deleted
5 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/BinaryProblem.cs

    r11983 r11987  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Parameters;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3031
    31 namespace HeuristicLab.Problems.BinaryVector {
     32namespace HeuristicLab.Problems.Binary {
    3233  [StorableClass]
    33   public abstract class BinaryVectorProblem : Problem, IBinaryVectorProblem {
    34     private const string LengthParameterName = "Length";
     34  public abstract class BinaryProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> {
    3535
    36     public IFixedValueParameter<IntValue> LengthParameter {
    37       get { return (IFixedValueParameter<IntValue>)Parameters[LengthParameterName]; }
    38     }
    39 
    40     public int Length {
    41       get { return LengthParameter.Value.Value; }
    42       set { LengthParameter.Value.Value = value; }
    43     }
    44 
    45     public abstract bool Maximization {
    46       get;
     36    public virtual int Length {
     37      get { return Encoding.Length; }
     38      set { Encoding.Length = value; }
    4739    }
    4840
    4941    [StorableConstructor]
    50     protected BinaryVectorProblem(bool deserializing) : base(deserializing) { }
    51     protected BinaryVectorProblem(BinaryVectorProblem original, Cloner cloner) : base(original, cloner) { }
    52     public bool IsBetter(double quality, double bestQuality) {
     42    protected BinaryProblem(bool deserializing) : base(deserializing) { }
     43    protected BinaryProblem(BinaryProblem original, Cloner cloner) : base(original, cloner) { }
     44    protected BinaryProblem() : base() { }
     45
     46    public virtual bool IsBetter(double quality, double bestQuality) {
    5347      return (Maximization && quality > bestQuality || !Maximization && quality < bestQuality);
    5448    }
    5549
    56     public BinaryVectorProblem()
    57       : base() {
    58       Parameters.Add(new FixedValueParameter<IntValue>(LengthParameterName, "", new IntValue(20)));
     50    public sealed override double Evaluate(Individual individual, IRandom random) {
     51      return Evaluate(individual.BinaryVector(), random);
    5952    }
    6053
    61     public abstract double Evaluate(bool[] individual);
    62 
    63 
     54    public abstract double Evaluate(BinaryVector vector, IRandom random);
    6455  }
    6556}
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/DeceptiveStepTrapProblem.cs

    r11960 r11987  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
    2728using HeuristicLab.Parameters;
    2829using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    30 namespace HeuristicLab.Problems.BinaryVector {
     31namespace HeuristicLab.Problems.Binary {
    3132  [Item("Deceptive Step Trap Problem", "Genome encodes completely separable blocks, where each block deceptive with fitness plateaus.")]
    3233  [StorableClass]
     
    8384    }
    8485
    85     protected override int Score(bool[] individual, int trapIndex, int trapSize) {
     86    protected override int Score(BinaryVector individual, int trapIndex, int trapSize) {
    8687      int partial = base.Score(individual, trapIndex, trapSize);
    8788      // introduce plateaus using integer division
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/DeceptiveTrapProblem.cs

    r11960 r11987  
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Data;
     28using HeuristicLab.Encodings.BinaryVectorEncoding;
    2829using HeuristicLab.Parameters;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3031
    31 namespace HeuristicLab.Problems.BinaryVector {
     32namespace HeuristicLab.Problems.Binary {
    3233  [Item("Deceptive Trap Problem", "Genome encodes completely separable blocks, where each block is fully deceptive.")]
    3334  [StorableClass]
    3435  [Creatable("Problems")]
    35   public class DeceptiveTrapProblem : BinaryVectorProblem {
     36  public class DeceptiveTrapProblem : BinaryProblem {
    3637    [StorableConstructor]
    3738    protected DeceptiveTrapProblem(bool deserializing) : base(deserializing) { }
     
    6970
    7071    // In the GECCO paper, calculates Equation 3
    71     protected virtual int Score(bool[] individual, int trapIndex, int trapSize) {
     72    protected virtual int Score(BinaryVector individual, int trapIndex, int trapSize) {
    7273      int result = 0;
    7374      // count number of bits in trap set to 1
     
    8384    }
    8485
    85     public override double Evaluate(bool[] individual) {
     86    public override double Evaluate(BinaryVector individual, IRandom random) {
    8687      if (individual.Length != Length) throw new ArgumentException("The individual has not the correct length.");
    8788      int total = 0;
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/HIFFProblem.cs

    r11960 r11987  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Encodings.BinaryVectorEncoding;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829
    29 namespace HeuristicLab.Problems.BinaryVector {
     30namespace HeuristicLab.Problems.Binary {
    3031  [Item("Hierararchical If and only If problem", "Genome evaluated in nested subsets to see if each subset contains either all 0s or all 1s.")]
    3132  [StorableClass]
    3233  [Creatable("Problems")]
    33   public class HIFFProblem : BinaryVectorProblem {
     34  public class HIFFProblem : BinaryProblem {
    3435    [StorableConstructor]
    3536    protected HIFFProblem(bool deserializing) : base(deserializing) { }
     
    5051    }
    5152    // In the GECCO paper, Section 4.1
    52     public override double Evaluate(bool[] individual) {
     53    public override double Evaluate(BinaryVector individual, IRandom random) {
    5354      int[] level = new int[individual.Length];
    5455      int levelLength = individual.Length;
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj

    r11983 r11987  
    88    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    10     <RootNamespace>HeuristicLab.Problems.BinaryVector</RootNamespace>
    11     <AssemblyName>HeuristicLab.Problems.BinaryVector-3.3</AssemblyName>
     10    <RootNamespace>HeuristicLab.Problems.Binary</RootNamespace>
     11    <AssemblyName>HeuristicLab.Problems.Binary-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
     
    8282  </ItemGroup>
    8383  <ItemGroup>
    84     <Compile Include="BinaryVectorProblem.cs" />
     84    <Compile Include="BinaryProblem.cs" />
    8585    <Compile Include="DeceptiveStepTrapProblem.cs" />
    8686    <Compile Include="DeceptiveTrapProblem.cs" />
    8787    <Compile Include="HIFFProblem.cs" />
    88     <Compile Include="IBinaryVectorProblem.cs" />
    8988    <Compile Include="Plugin.cs" />
    9089    <Compile Include="Properties\AssemblyInfo.cs" />
     
    9998      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    10099      <Name>HeuristicLab.Collections-3.3</Name>
     100      <Private>False</Private>
    101101    </ProjectReference>
    102102    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    103103      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
    104104      <Name>HeuristicLab.Common-3.3</Name>
     105      <Private>False</Private>
    105106    </ProjectReference>
    106107    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    107108      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
    108109      <Name>HeuristicLab.Core-3.3</Name>
     110      <Private>False</Private>
    109111    </ProjectReference>
    110112    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    111113      <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>
    112114      <Name>HeuristicLab.Data-3.3</Name>
     115      <Private>False</Private>
     116    </ProjectReference>
     117    <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">
     118      <Project>{66d249c3-a01d-42a8-82a2-919bc8ec3d83}</Project>
     119      <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>
     120      <Private>False</Private>
     121    </ProjectReference>
     122    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
     123      <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
     124      <Name>HeuristicLab.Operators-3.3</Name>
     125      <Private>False</Private>
    113126    </ProjectReference>
    114127    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    115128      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    116129      <Name>HeuristicLab.Optimization-3.3</Name>
     130      <Private>False</Private>
    117131    </ProjectReference>
    118132    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    119133      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
    120134      <Name>HeuristicLab.Parameters-3.3</Name>
     135      <Private>False</Private>
    121136    </ProjectReference>
    122137    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
    123138      <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>
    124139      <Name>HeuristicLab.Persistence-3.3</Name>
     140      <Private>False</Private>
    125141    </ProjectReference>
    126142    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    127143      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
    128144      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     145      <Private>False</Private>
    129146    </ProjectReference>
    130147  </ItemGroup>
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/Plugin.cs.frame

    r11956 r11987  
    2525using HeuristicLab.PluginInfrastructure;
    2626
    27 namespace HeuristicLab.Problems.BinaryVector {
    28   [Plugin("HeuristicLab.Problems.BinaryVector","Provides binary benchmark problems.", "3.3.10.$WCREV$")]
    29   [PluginFile("HeuristicLab.Problems.BinaryVector-3.3.dll", PluginFileType.Assembly)]
     27namespace HeuristicLab.Problems.Binary {
     28  [Plugin("HeuristicLab.Problems.Binary","Provides binary benchmark problems.", "3.3.10.$WCREV$")]
     29  [PluginFile("HeuristicLab.Problems.Binary-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3131  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3535  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3636  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    37   public class Plugin : PluginBase {
     37  public class HeuristicLabProblemsBinaryPlugin : PluginBase {
    3838  }
    3939}
  • trunk/sources/HeuristicLab.Problems.Binary/3.3/Properties/AssemblyInfo.cs.frame

    r11956 r11987  
    2626// set of attributes. Change these attribute values to modify the information
    2727// associated with an assembly.
    28 [assembly: AssemblyTitle("HeuristicLab.Problems.BinaryVector")]
     28[assembly: AssemblyTitle("HeuristicLab.Problems.Binary")]
    2929[assembly: AssemblyDescription("Provides binary benchmark problems.")]
    3030[assembly: AssemblyConfiguration("")]
Note: See TracChangeset for help on using the changeset viewer.