Changeset 11987 for trunk/sources/HeuristicLab.Problems.Binary/3.3
- Timestamp:
- 02/12/15 15:39:28 (10 years ago)
- 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 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Data; 27 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 31 31 namespace HeuristicLab.Problems.Binary Vector{32 namespace HeuristicLab.Problems.Binary { 32 33 [StorableClass] 33 public abstract class BinaryVectorProblem : Problem, IBinaryVectorProblem { 34 private const string LengthParameterName = "Length"; 34 public abstract class BinaryProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> { 35 35 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; } 47 39 } 48 40 49 41 [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) { 53 47 return (Maximization && quality > bestQuality || !Maximization && quality < bestQuality); 54 48 } 55 49 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); 59 52 } 60 53 61 public abstract double Evaluate(bool[] individual); 62 63 54 public abstract double Evaluate(BinaryVector vector, IRandom random); 64 55 } 65 56 } -
trunk/sources/HeuristicLab.Problems.Binary/3.3/DeceptiveStepTrapProblem.cs
r11960 r11987 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Data; 27 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 28 using HeuristicLab.Parameters; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 namespace HeuristicLab.Problems.Binary Vector{31 namespace HeuristicLab.Problems.Binary { 31 32 [Item("Deceptive Step Trap Problem", "Genome encodes completely separable blocks, where each block deceptive with fitness plateaus.")] 32 33 [StorableClass] … … 83 84 } 84 85 85 protected override int Score( bool[]individual, int trapIndex, int trapSize) {86 protected override int Score(BinaryVector individual, int trapIndex, int trapSize) { 86 87 int partial = base.Score(individual, trapIndex, trapSize); 87 88 // introduce plateaus using integer division -
trunk/sources/HeuristicLab.Problems.Binary/3.3/DeceptiveTrapProblem.cs
r11960 r11987 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Data; 28 using HeuristicLab.Encodings.BinaryVectorEncoding; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 31 31 namespace HeuristicLab.Problems.Binary Vector{32 namespace HeuristicLab.Problems.Binary { 32 33 [Item("Deceptive Trap Problem", "Genome encodes completely separable blocks, where each block is fully deceptive.")] 33 34 [StorableClass] 34 35 [Creatable("Problems")] 35 public class DeceptiveTrapProblem : Binary VectorProblem {36 public class DeceptiveTrapProblem : BinaryProblem { 36 37 [StorableConstructor] 37 38 protected DeceptiveTrapProblem(bool deserializing) : base(deserializing) { } … … 69 70 70 71 // 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) { 72 73 int result = 0; 73 74 // count number of bits in trap set to 1 … … 83 84 } 84 85 85 public override double Evaluate( bool[] individual) {86 public override double Evaluate(BinaryVector individual, IRandom random) { 86 87 if (individual.Length != Length) throw new ArgumentException("The individual has not the correct length."); 87 88 int total = 0; -
trunk/sources/HeuristicLab.Problems.Binary/3.3/HIFFProblem.cs
r11960 r11987 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Encodings.BinaryVectorEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 29 namespace HeuristicLab.Problems.Binary Vector{30 namespace HeuristicLab.Problems.Binary { 30 31 [Item("Hierararchical If and only If problem", "Genome evaluated in nested subsets to see if each subset contains either all 0s or all 1s.")] 31 32 [StorableClass] 32 33 [Creatable("Problems")] 33 public class HIFFProblem : Binary VectorProblem {34 public class HIFFProblem : BinaryProblem { 34 35 [StorableConstructor] 35 36 protected HIFFProblem(bool deserializing) : base(deserializing) { } … … 50 51 } 51 52 // In the GECCO paper, Section 4.1 52 public override double Evaluate( bool[] individual) {53 public override double Evaluate(BinaryVector individual, IRandom random) { 53 54 int[] level = new int[individual.Length]; 54 55 int levelLength = individual.Length; -
trunk/sources/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj
r11983 r11987 8 8 <OutputType>Library</OutputType> 9 9 <AppDesignerFolder>Properties</AppDesignerFolder> 10 <RootNamespace>HeuristicLab.Problems.Binary Vector</RootNamespace>11 <AssemblyName>HeuristicLab.Problems.Binary Vector-3.3</AssemblyName>10 <RootNamespace>HeuristicLab.Problems.Binary</RootNamespace> 11 <AssemblyName>HeuristicLab.Problems.Binary-3.3</AssemblyName> 12 12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 13 13 <FileAlignment>512</FileAlignment> … … 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="Binary VectorProblem.cs" />84 <Compile Include="BinaryProblem.cs" /> 85 85 <Compile Include="DeceptiveStepTrapProblem.cs" /> 86 86 <Compile Include="DeceptiveTrapProblem.cs" /> 87 87 <Compile Include="HIFFProblem.cs" /> 88 <Compile Include="IBinaryVectorProblem.cs" />89 88 <Compile Include="Plugin.cs" /> 90 89 <Compile Include="Properties\AssemblyInfo.cs" /> … … 99 98 <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project> 100 99 <Name>HeuristicLab.Collections-3.3</Name> 100 <Private>False</Private> 101 101 </ProjectReference> 102 102 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 103 103 <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project> 104 104 <Name>HeuristicLab.Common-3.3</Name> 105 <Private>False</Private> 105 106 </ProjectReference> 106 107 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 107 108 <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project> 108 109 <Name>HeuristicLab.Core-3.3</Name> 110 <Private>False</Private> 109 111 </ProjectReference> 110 112 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 111 113 <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project> 112 114 <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> 113 126 </ProjectReference> 114 127 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 115 128 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> 116 129 <Name>HeuristicLab.Optimization-3.3</Name> 130 <Private>False</Private> 117 131 </ProjectReference> 118 132 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 119 133 <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project> 120 134 <Name>HeuristicLab.Parameters-3.3</Name> 135 <Private>False</Private> 121 136 </ProjectReference> 122 137 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 123 138 <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project> 124 139 <Name>HeuristicLab.Persistence-3.3</Name> 140 <Private>False</Private> 125 141 </ProjectReference> 126 142 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 127 143 <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project> 128 144 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 145 <Private>False</Private> 129 146 </ProjectReference> 130 147 </ItemGroup> -
trunk/sources/HeuristicLab.Problems.Binary/3.3/Plugin.cs.frame
r11956 r11987 25 25 using HeuristicLab.PluginInfrastructure; 26 26 27 namespace HeuristicLab.Problems.Binary Vector{28 [Plugin("HeuristicLab.Problems.Binary Vector","Provides binary benchmark problems.", "3.3.10.$WCREV$")]29 [PluginFile("HeuristicLab.Problems.Binary Vector-3.3.dll", PluginFileType.Assembly)]27 namespace 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)] 30 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 31 [PluginDependency("HeuristicLab.Common", "3.3")] … … 35 35 [PluginDependency("HeuristicLab.Parameters", "3.3")] 36 36 [PluginDependency("HeuristicLab.Persistence", "3.3")] 37 public class Plugin : PluginBase {37 public class HeuristicLabProblemsBinaryPlugin : PluginBase { 38 38 } 39 39 } -
trunk/sources/HeuristicLab.Problems.Binary/3.3/Properties/AssemblyInfo.cs.frame
r11956 r11987 26 26 // set of attributes. Change these attribute values to modify the information 27 27 // associated with an assembly. 28 [assembly: AssemblyTitle("HeuristicLab.Problems.Binary Vector")]28 [assembly: AssemblyTitle("HeuristicLab.Problems.Binary")] 29 29 [assembly: AssemblyDescription("Provides binary benchmark problems.")] 30 30 [assembly: AssemblyConfiguration("")]
Note: See TracChangeset
for help on using the changeset viewer.