Changeset 12915 for trunk/sources
- Timestamp:
- 08/27/15 10:20:09 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 2 deleted
- 13 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab 3.3.sln
r12899 r12915 442 442 EndProject 443 443 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.LawnMower.Views-3.4", "HeuristicLab.Problems.LawnMower.Views\3.4\HeuristicLab.Problems.LawnMower.Views-3.4.csproj", "{E186E7BD-E90E-4027-9965-D5E0DBEB00E8}" 444 EndProject 445 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneticProgramming-3.3", "HeuristicLab.Problems.GeneticProgramming\3.3\HeuristicLab.Problems.GeneticProgramming-3.3.csproj", "{02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}" 446 EndProject 447 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GrammaticalEvolution-3.4", "HeuristicLab.Problems.GrammaticalEvolution\3.4\HeuristicLab.Problems.GrammaticalEvolution-3.4.csproj", "{9372D115-D933-40D2-BD29-A2C1EAC35874}" 448 EndProject 449 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneticProgramming.Views-3.3", "HeuristicLab.Problems.GeneticProgramming.Views\3.3\HeuristicLab.Problems.GeneticProgramming.Views-3.3.csproj", "{26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}" 444 450 EndProject 445 451 Global … … 2169 2175 {E186E7BD-E90E-4027-9965-D5E0DBEB00E8}.Release|x86.ActiveCfg = Release|x86 2170 2176 {E186E7BD-E90E-4027-9965-D5E0DBEB00E8}.Release|x86.Build.0 = Release|x86 2177 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 2178 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|Any CPU.Build.0 = Debug|Any CPU 2179 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|x64.ActiveCfg = Debug|x64 2180 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|x64.Build.0 = Debug|x64 2181 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|x86.ActiveCfg = Debug|x86 2182 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Debug|x86.Build.0 = Debug|x86 2183 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|Any CPU.ActiveCfg = Release|Any CPU 2184 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|Any CPU.Build.0 = Release|Any CPU 2185 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|x64.ActiveCfg = Release|x64 2186 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|x64.Build.0 = Release|x64 2187 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|x86.ActiveCfg = Release|x86 2188 {02CDDBF5-42A7-4C40-AE6C-E5D29AC9CCEC}.Release|x86.Build.0 = Release|x86 2189 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 2190 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|Any CPU.Build.0 = Debug|Any CPU 2191 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|x64.ActiveCfg = Debug|x64 2192 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|x64.Build.0 = Debug|x64 2193 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|x86.ActiveCfg = Debug|x86 2194 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Debug|x86.Build.0 = Debug|x86 2195 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|Any CPU.ActiveCfg = Release|Any CPU 2196 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|Any CPU.Build.0 = Release|Any CPU 2197 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|x64.ActiveCfg = Release|x64 2198 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|x64.Build.0 = Release|x64 2199 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|x86.ActiveCfg = Release|x86 2200 {9372D115-D933-40D2-BD29-A2C1EAC35874}.Release|x86.Build.0 = Release|x86 2201 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 2202 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|Any CPU.Build.0 = Debug|Any CPU 2203 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|x64.ActiveCfg = Debug|x64 2204 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|x64.Build.0 = Debug|x64 2205 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|x86.ActiveCfg = Debug|x86 2206 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Debug|x86.Build.0 = Debug|x86 2207 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|Any CPU.ActiveCfg = Release|Any CPU 2208 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|Any CPU.Build.0 = Release|Any CPU 2209 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|x64.ActiveCfg = Release|x64 2210 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|x64.Build.0 = Release|x64 2211 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|x86.ActiveCfg = Release|x86 2212 {26349C8D-72A1-4BAE-95A3-14E96A3B4AE8}.Release|x86.Build.0 = Release|x86 2171 2213 EndGlobalSection 2172 2214 GlobalSection(SolutionProperties) = preSolution … … 2174 2216 EndGlobalSection 2175 2217 GlobalSection(NestedProjects) = preSolution 2176 {5E516C4F-9935-437F-8B15-ECEF4451744E} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5}2177 {0C67A033-F6D9-4237-B3CA-C033A44706BE} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5}2178 2218 {3083C7AA-5AF4-4C75-BA19-B69B86E2F66A} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2179 2219 {9A04599C-D608-4240-8DA6-D41F51C515A3} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2180 2220 {71CDE004-C50F-48DF-858E-AB0AAA3537BC} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2221 {5E516C4F-9935-437F-8B15-ECEF4451744E} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2222 {0C67A033-F6D9-4237-B3CA-C033A44706BE} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2223 {7FC70D74-1813-48B7-9CE5-0BD913457579} = {D1B1DE45-F9C7-4FBF-B73C-E759BC4223D5} 2181 2224 EndGlobalSection 2182 2225 EndGlobal -
trunk/sources/HeuristicLab.Problems.GeneticProgramming.Views/3.3/Plugin.cs.frame
r12911 r12915 28 28 [Plugin("HeuristicLab.Problems.GeneticProgramming.Views","Provides views for for genetic programming problems such as the artificial ant problem.", "3.3.0.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.GeneticProgramming.Views-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Common","3.3")]31 30 [PluginDependency("HeuristicLab.Core","3.3")] 32 31 [PluginDependency("HeuristicLab.Core.Views","3.3")] -
trunk/sources/HeuristicLab.Problems.GeneticProgramming/3.3/Plugin.cs.frame
r12911 r12915 37 37 [PluginDependency("HeuristicLab.Parameters", "3.3")] 38 38 [PluginDependency("HeuristicLab.Persistence", "3.3")] 39 [PluginDependency("HeuristicLab.Random", "3.3")] 39 40 public class HeuristicLabProblemsGeneticProgrammingPlugin : PluginBase { 40 41 } -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntEvaluator.cs
r12481 r12915 31 31 using HeuristicLab.Parameters; 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 using HeuristicLab.Problems. ArtificialAnt;33 using HeuristicLab.Problems.GeneticProgramming.ArtificialAnt; 34 34 using HeuristicLab.Problems.GrammaticalEvolution.Mappers; 35 35 … … 123 123 IntValue maxTimeSteps = MaxTimeStepsParameter.ActualValue; 124 124 125 AntInterpreter interpreter = new AntInterpreter();125 Interpreter interpreter = new Interpreter(); 126 126 interpreter.MaxTimeSteps = maxTimeSteps.Value; 127 127 interpreter.World = world; -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs
r12504 r12915 22 22 #endregion 23 23 24 using System; 25 using System.Collections.Generic; 24 using System.Diagnostics.Contracts; 26 25 using System.Linq; 27 26 using HeuristicLab.Common; … … 29 28 using HeuristicLab.Data; 30 29 using HeuristicLab.Encodings.IntegerVectorEncoding; 31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;32 30 using HeuristicLab.Optimization; 33 31 using HeuristicLab.Parameters; 34 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 35 using HeuristicLab.PluginInfrastructure; 36 using HeuristicLab.Problems.ArtificialAnt; 37 using HeuristicLab.Problems.ArtificialAnt.Analyzers; 33 using HeuristicLab.Problems.GeneticProgramming.ArtificialAnt; 38 34 using HeuristicLab.Problems.GrammaticalEvolution.Mappers; 39 35 … … 42 38 [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 170)] 43 39 [StorableClass] 44 public sealed class GEArtificialAntProblem : SingleObjective HeuristicOptimizationProblem<GEArtificialAntEvaluator, IIntegerVectorCreator>, IStorableContent {40 public sealed class GEArtificialAntProblem : SingleObjectiveBasicProblem<IntegerVectorEncoding>, IStorableContent { 45 41 public string Filename { get; set; } 46 42 47 #region constant for default world (Santa Fe)48 private readonly bool[,] santaFeAntTrail = new bool[,] {49 {false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},50 {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},51 {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, false, false, false, false},52 {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, true, false, false},53 {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, true, false, false},54 {false, false, false, true, true, true, true, false, true, true, true, true, true, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false},55 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false},56 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},57 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},58 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, true, false, false},59 {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},60 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},61 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false},62 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},63 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, true, true, true, false, false, false},64 {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, false},65 {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},66 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},67 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false},68 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false},69 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},70 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},71 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false},72 {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false},73 {false, false, false, true, true, false, false, true, true, true, true, true, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},74 {false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},75 {false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},76 {false, true, false, false, false, false, false, false, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},77 {false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},78 {false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},79 {false, false, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },80 {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }81 };82 #endregion83 84 43 #region Parameter Properties 85 public IValueParameter<ISymbolicExpressionGrammar> ArtificialAntExpressionGrammarParameter {86 get { return (IValueParameter<ISymbolicExpressionGrammar>)Parameters["ArtificialAntExpressionGrammar"]; }87 }88 public IValueParameter<IntValue> MaxExpressionLengthParameter {89 get { return (IValueParameter<IntValue>)Parameters["MaximumExpressionLength"]; }90 }91 44 public IValueParameter<BoolMatrix> WorldParameter { 92 45 get { return (IValueParameter<BoolMatrix>)Parameters["World"]; } 93 46 } 94 public IValueParameter<IntValue> MaxTimeStepsParameter { 95 get { return (IValueParameter<IntValue>)Parameters["MaximumTimeSteps"]; } 96 } 97 public IValueParameter<IntMatrix> BoundsParameter { 98 get { return (IValueParameter<IntMatrix>)Parameters["Bounds"]; } 47 public IFixedValueParameter<IntValue> MaxTimeStepsParameter { 48 get { return (IFixedValueParameter<IntValue>)Parameters["MaximumTimeSteps"]; } 99 49 } 100 50 public IValueParameter<IGenotypeToPhenotypeMapper> GenotypeToPhenotypeMapperParameter { … … 108 58 set { WorldParameter.Value = value; } 109 59 } 110 public IntValue MaxTimeSteps { 111 get { return MaxTimeStepsParameter.Value; } 112 set { MaxTimeStepsParameter.Value = value; } 113 } 114 public IntValue MaxExpressionLength { 115 get { return MaxExpressionLengthParameter.Value; } 116 set { MaxExpressionLengthParameter.Value = value; } 117 } 118 public ArtificialAntExpressionGrammar ArtificialAntExpressionGrammar { 119 get { return (ArtificialAntExpressionGrammar)ArtificialAntExpressionGrammarParameter.Value; } 120 } 121 public IEnumerable<IAntTrailAnalyzer> AntTrailAnalyzers { 122 get { return Operators.OfType<IAntTrailAnalyzer>(); } 123 } 124 public IntMatrix Bounds { 125 get { return BoundsParameter.Value; } 126 set { BoundsParameter.Value = value; } 60 public int MaxTimeSteps { 61 get { return MaxTimeStepsParameter.Value.Value; } 62 set { MaxTimeStepsParameter.Value.Value = value; } 127 63 } 128 64 #endregion … … 131 67 private GEArtificialAntProblem(bool deserializing) : base(deserializing) { } 132 68 [StorableHook(HookType.AfterDeserialization)] 133 private void AfterDeserialization() { 134 RegisterEventHandlers(); 69 private void AfterDeserialization() { } 70 71 public override bool Maximization { 72 get { return true; } 135 73 } 74 75 [Storable] 76 // parameters of the wrapped problem cannot be changed therefore it is not strictly necessary to clone and store it 77 private readonly HeuristicLab.Problems.GeneticProgramming.ArtificialAnt.Problem wrappedAntProblem; 136 78 137 79 private GEArtificialAntProblem(GEArtificialAntProblem original, Cloner cloner) 138 80 : base(original, cloner) { 139 RegisterEventHandlers();81 this.wrappedAntProblem = cloner.Clone(original.wrappedAntProblem); 140 82 } 141 83 … … 145 87 146 88 public GEArtificialAntProblem() 147 : base(new GEArtificialAntEvaluator(), new UniformRandomIntegerVectorCreator()) { 148 BoolMatrix world = new BoolMatrix(santaFeAntTrail); 149 Parameters.Add(new ValueParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant (genotype length).", new IntValue(30))); 150 Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("ArtificialAntExpressionGrammar", "The grammar that should be used for artificial ant expressions.", new ArtificialAntExpressionGrammar())); 151 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world)); 152 Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600))); 153 IntMatrix m = new IntMatrix(new int[,] { { 0, 100 } }); 154 Parameters.Add(new ValueParameter<IntMatrix>("Bounds", "The integer number range in which the single genomes of a genotype are created.", m)); 89 : base() { 90 wrappedAntProblem = new HeuristicLab.Problems.GeneticProgramming.ArtificialAnt.Problem(); 91 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", wrappedAntProblem.World)); 92 Parameters.Add(new FixedValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600))); 155 93 Parameters.Add(new ValueParameter<IGenotypeToPhenotypeMapper>("GenotypeToPhenotypeMapper", "Maps the genotype (an integer vector) to the phenotype (a symbolic expression tree).", new DepthFirstMapper())); 156 94 157 Maximization.Value = true; 158 MaximizationParameter.Hidden = true; 159 BestKnownQuality = new DoubleValue(89); 95 Encoding = new IntegerVectorEncoding(30) { Bounds = new IntMatrix(new int[,] { { 0, 100 } }) }; 160 96 161 SolutionCreator.IntegerVectorParameter.ActualName = "AntTrailSolutionIntegerVector"; 162 Evaluator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolutionTree"; 163 Evaluator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar"; 164 Evaluator.QualityParameter.ActualName = "FoodEaten"; 165 166 InitializeOperators(); 167 RegisterEventHandlers(); 97 BestKnownQuality = wrappedAntProblem.BestKnownQuality; 168 98 } 169 99 170 #region Events 171 protected override void OnSolutionCreatorChanged() { 172 base.OnSolutionCreatorChanged(); 100 public override double Evaluate(Individual individual, IRandom random) { 101 var vector = individual.IntegerVector(); 173 102 174 SolutionCreator.IntegerVectorParameter.ActualName = "AntTrailSolutionIntegerVector"; 175 SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged); 103 var bounds = Encoding.Bounds; 104 var len = Encoding.Length; 105 var grammar = wrappedAntProblem.Encoding.Grammar; 106 var mapper = GenotypeToPhenotypeMapperParameter.Value; 176 107 177 ParameterizeAnalyzers(); 178 ParameterizeOperators(); 108 var tree = mapper.Map(random, bounds, len, grammar, vector); 109 110 Interpreter interpreter = new Interpreter(tree, World, MaxTimeSteps); 111 interpreter.Run(); 112 113 return interpreter.FoodEaten; 179 114 } 180 115 181 protected override void OnEvaluatorChanged() { 182 base.OnEvaluatorChanged(); 116 public override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) { 117 var bounds = Encoding.Bounds; 118 var len = Encoding.Length; 119 var grammar = wrappedAntProblem.Encoding.Grammar; 120 var mapper = GenotypeToPhenotypeMapperParameter.Value; 183 121 184 Evaluator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolutionTree";185 Evaluator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar";186 Evaluator.QualityParameter.ActualName = "FoodEaten";122 var trees = individuals 123 .Select(ind => mapper.Map(random, bounds, len, grammar, ind.IntegerVector())) 124 .ToArray(); 187 125 188 Evaluator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged); 189 Evaluator.SymbolicExpressionTreeGrammarParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged); 190 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 191 192 ParameterizeAnalyzers(); 193 ParameterizeOperators(); 126 wrappedAntProblem.Analyze(trees, qualities, results, random); 194 127 } 195 196 private void SolutionCreator_IntegerVectorParameter_ActualNameChanged(object sender, EventArgs e) {197 ParameterizeAnalyzers();198 ParameterizeOperators();199 }200 201 private void Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged(object sender, EventArgs e) {202 ParameterizeAnalyzers();203 ParameterizeOperators();204 }205 206 private void Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged(object sender, EventArgs e) {207 ParameterizeAnalyzers();208 ParameterizeOperators();209 }210 211 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {212 ParameterizeAnalyzers();213 ParameterizeOperators();214 }215 #endregion216 217 #region Helpers218 private void RegisterEventHandlers() {219 SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);220 Evaluator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged);221 Evaluator.SymbolicExpressionTreeGrammarParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged);222 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);223 }224 225 private void InitializeOperators() {226 Operators.AddRange(ApplicationManager.Manager.GetInstances<IIntegerVectorOperator>().OfType<IOperator>());227 Operators.Add(new BestAntTrailAnalyzer());228 Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());229 Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());230 ParameterizeAnalyzers();231 ParameterizeOperators();232 }233 234 private void ParameterizeAnalyzers() {235 foreach (IAntTrailAnalyzer analyzer in AntTrailAnalyzers) {236 analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;237 analyzer.SymbolicExpressionTreeParameter.ActualName = Evaluator.SymbolicExpressionTreeParameter.ActualName;238 analyzer.WorldParameter.ActualName = WorldParameter.Name;239 analyzer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;240 }241 foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {242 analyzer.SymbolicExpressionTreeParameter.ActualName = Evaluator.SymbolicExpressionTreeParameter.ActualName;243 }244 }245 246 private void ParameterizeOperators() {247 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);248 249 foreach (ISymbolicExpressionTreeGrammarBasedOperator op in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) {250 op.SymbolicExpressionTreeGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;251 }252 foreach (GEArtificialAntEvaluator op in operators.OfType<GEArtificialAntEvaluator>()) {253 op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;254 op.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;255 op.WorldParameter.ActualName = WorldParameter.Name;256 }257 foreach (IIntegerVectorCrossover op in operators.OfType<IIntegerVectorCrossover>()) {258 op.ParentsParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;259 op.ChildParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;260 }261 foreach (IIntegerVectorManipulator op in operators.OfType<IIntegerVectorManipulator>()) {262 op.IntegerVectorParameter.ActualName = SolutionCreator.IntegerVectorParameter.ActualName;263 }264 foreach (IIntegerVectorCreator op in operators.OfType<IIntegerVectorCreator>()) {265 op.BoundsParameter.ActualName = BoundsParameter.Name;266 op.LengthParameter.ActualName = MaxExpressionLengthParameter.Name;267 }268 }269 #endregion270 128 } 271 129 } -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/BreathFirstMapper.cs
r12012 r12915 59 59 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 60 60 /// <returns>phenotype (a symbolic expression tree)</returns> 61 public override SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,61 public override ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 62 62 ISymbolicExpressionGrammar grammar, 63 63 IntegerVector genotype) { -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/DepthFirstMapper.cs
r12012 r12915 60 60 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 61 61 /// <returns>phenotype (a symbolic expression tree)</returns> 62 public override SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,62 public override ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 63 63 ISymbolicExpressionGrammar grammar, 64 64 IntegerVector genotype) { -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/GenotypeToPhenotypeMapper.cs
r12422 r12915 44 44 protected GenotypeToPhenotypeMapper() : base() { } 45 45 46 public abstract SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,46 public abstract ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 47 47 ISymbolicExpressionGrammar grammar, 48 48 IntegerVector genotype); -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/IGenotypeToPhenotypeMapper.cs
r12012 r12915 32 32 /// </summary> 33 33 public interface IGenotypeToPhenotypeMapper : IIntegerVectorOperator { 34 SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,34 ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 35 35 ISymbolicExpressionGrammar grammar, 36 36 IntegerVector genotype); -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/PIGEMapper.cs
r12012 r12915 105 105 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 106 106 /// <returns>phenotype (a symbolic expression tree)</returns> 107 public override SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,107 public override ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 108 108 ISymbolicExpressionGrammar grammar, 109 109 IntegerVector genotype) { -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Mappers/RandomMapper.cs
r12422 r12915 59 59 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 60 60 /// <returns>phenotype (a symbolic expression tree)</returns> 61 public override SymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length,61 public override ISymbolicExpressionTree Map(IRandom random, IntMatrix bounds, int length, 62 62 ISymbolicExpressionGrammar grammar, 63 63 IntegerVector genotype) { -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Plugin.cs.frame
r12753 r12915 26 26 27 27 namespace HeuristicLab.Problems.GrammaticalEvolution { 28 [Plugin("HeuristicLab.Problems.GrammaticalEvolution","Provides classes for grammatical evolution.", "3. 3.12.$WCREV$")]29 [PluginFile("HeuristicLab.Problems.GrammaticalEvolution-3. 3.dll", PluginFileType.Assembly)]28 [Plugin("HeuristicLab.Problems.GrammaticalEvolution","Provides classes for grammatical evolution.", "3.4.0.$WCREV$")] 29 [PluginFile("HeuristicLab.Problems.GrammaticalEvolution-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 31 [PluginDependency("HeuristicLab.Common", "3.3")] … … 39 39 [PluginDependency("HeuristicLab.Parameters", "3.3")] 40 40 [PluginDependency("HeuristicLab.Persistence", "3.3")] 41 [PluginDependency("HeuristicLab.Problems. ArtificialAnt", "3.4")]41 [PluginDependency("HeuristicLab.Problems.GeneticProgramming", "3.3")] // for artificial ant problem 42 42 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 43 43 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] -
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.4/Properties/AssemblyInfo.cs.frame
r12753 r12915 43 43 44 44 // The following GUID is for the ID of the typelib if this project is exposed to COM 45 [assembly: Guid(" B3B18403-394F-423D-ADD0-C65EF47D42E2")]45 [assembly: Guid("3E6DC5DA-2C8D-48BF-83C6-9D990872F3A0")] 46 46 // Version information for an assembly consists of the following four values: 47 47 // … … 53 53 // You can specify all the values or you can default the Revision and Build Numbers 54 54 // by using the '*' as shown below: 55 [assembly: AssemblyVersion("3. 3.0.0")]56 [assembly: AssemblyFileVersion("3. 3.12.$WCREV$")]55 [assembly: AssemblyVersion("3.4.0.0")] 56 [assembly: AssemblyFileVersion("3.4.0.$WCREV$")]
Note: See TracChangeset
for help on using the changeset viewer.