Changeset 9846
- Timestamp:
- 08/05/13 11:37:13 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlEditor.cs
r9843 r9846 24 24 using System.Linq; 25 25 using System.Text; 26 using HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm; 26 27 using HeuristicLab.MainForm.WindowsForms; 28 using HeuristicLab.Optimization; 27 29 using HeuristicLab.Problems.Instances; 28 30 using HeuristicLab.Problems.Instances.Views; … … 46 48 Parser parser = new Parser(scanner); 47 49 parser.Parse(); 48 MainForm.MainFormManager.MainForm.ShowContent(parser.problem); 50 51 // generate an OSGA to solve the problem 52 var osga = new OffspringSelectionGeneticAlgorithm(); 53 osga.Problem = parser.problem; 54 osga.Engine = new SequentialEngine.SequentialEngine(); 55 osga.PopulationSize.Value = 500; 56 osga.MutationProbability.Value = 0.15; 57 osga.ComparisonFactorUpperBound.Value = 1.0; 58 osga.ComparisonFactorLowerBound.Value = 1.0; 59 osga.MutatorParameter.Value = 60 osga.MutatorParameter.ValidValues.First(o => o.Name.Contains("MultiSymbolicExpressionTreeManipulator")); 61 osga.SelectorParameter.Value = 62 osga.SelectorParameter.ValidValues.First(o => o.Name.Contains("GenderSpecific")); 63 osga.MaximumSelectionPressure.Value = 500; 64 osga.MaximumGenerations.Value = 100; 65 MainForm.MainFormManager.MainForm.ShowContent(osga); 49 66 } 50 67 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/GpdlExampleProvider.cs
r9844 r9846 31 31 { 32 32 new GpdlExampleDataDescriptor("Artificial Ant", "The artificial ant problem.", Resources.Artificial_Ant), 33 new GpdlExampleDataDescriptor("Lawn mower", "The lawn mower benchmark problem.", Resources.LawnMower), 33 34 new GpdlExampleDataDescriptor("Factorial", "Evolve a program to calculate the factorial function.", Resources.Factorial), 34 35 new GpdlExampleDataDescriptor("Fibonacci", "Evolve a problem to calculate the fibonacci function.", Resources.Fib), -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/HeuristicLab.Problems.GPDL.Views-3.4.csproj
r9844 r9846 93 93 </PropertyGroup> 94 94 <ItemGroup> 95 <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 96 <SpecificVersion>False</SpecificVersion> 97 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath> 98 </Reference> 99 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 100 <SpecificVersion>False</SpecificVersion> 101 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 102 </Reference> 95 103 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 96 104 <SpecificVersion>False</SpecificVersion> … … 142 150 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.Views-3.3.dll</HintPath> 143 151 <Private>False</Private> 152 </Reference> 153 <Reference Include="HeuristicLab.SequentialEngine-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 154 <SpecificVersion>False</SpecificVersion> 155 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath> 144 156 </Reference> 145 157 <Reference Include="ICSharpCode.AvalonEdit, Version=4.3.1.9430, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL"> … … 263 275 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 264 276 </Content> 277 <None Include="Resources\LawnMower.txt" /> 265 278 <None Include="Resources\Multiplexer.txt" /> 266 279 <None Include="Resources\EvenParity.txt" /> -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.Designer.cs
r9844 r9846 197 197 198 198 /// <summary> 199 /// Looks up a localized string similar to PROBLEM LawnMower 200 /// 201 ///CODE << 202 /// public int Width { get { return 8; } } 203 /// public int Height { get { return 8; } } 204 /// 205 /// enum Direction {West, East, North, South}; 206 /// 207 /// class World { 208 /// private bool[,] mowed = new bool[Width, Height]; 209 /// public World() { 210 /// Reset(); 211 /// } 212 /// public void Reset() { 213 /// for(int col = 0; col < Width; col++) 214 /// for(int row = 0; row < Height; row++) { 215 /// mowed[col, row] = false; 216 /// } 217 /// } 218 /// public void SetCellMowed(int col, int row) { 219 /// m [rest of string was truncated]";. 220 /// </summary> 221 internal static string LawnMower { 222 get { 223 return ResourceManager.GetString("LawnMower", resourceCulture); 224 } 225 } 226 227 /// <summary> 199 228 /// Looks up a localized string similar to PROBLEM MultiOutputMultiplier 200 229 /// … … 220 249 /// 221 250 ///NONTERMINALS 222 /// Expr<<bool[] d, out bool p>>.223 /// AND<<bool[] d, out bool p>>.224 /// OR<<bool[] d, out bool p>>.225 /// NOT<<bool[] d, out bool p>>.226 /// IF<<bool[] d, out bool p>>.251 /// Expr<<bool[] d, out bool o>>. 252 /// AND<<bool[] d, out bool o>>. 253 /// OR<<bool[] d, out bool o>>. 254 /// NOT<<bool[] d, out bool o>>. 255 /// IF<<bool[] d, out bool o>>. 227 256 /// 228 257 ///TERMINALS 229 /// A0. A1. A2. A2.D0. D1. D2. D3. D4. D5. D6. D7.258 /// A0. A1. A2. D0. D1. D2. D3. D4. D5. D6. D7. 230 259 /// 231 260 ///RULES 232 261 /// Expr<<bool[] d, out bool o>> = 233 /// AND<<d, out p>>234 /// | OR<<d, out p>>235 /// | NOT<<d, out p>>236 /// | IF<<d, out p>>237 /// | A0 SEM<< p= d[0]; >>238 /// | A1 [rest of string was truncated]";.262 /// AND<<d, out o>> 263 /// | OR<<d, out o>> 264 /// | NOT<<d, out o>> 265 /// | IF<<d, out o>> 266 /// | A0 SEM<< o = d[0]; >> 267 /// | A1 [rest of string was truncated]";. 239 268 /// </summary> 240 269 internal static string Multiplexer { -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Properties/Resources.resx
r9844 r9846 134 134 <value>..\Resources\GPDL.xshd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> 135 135 </data> 136 <data name="LawnMower" type="System.Resources.ResXFileRef, System.Windows.Forms"> 137 <value>..\resources\lawnmower.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> 138 </data> 136 139 <data name="Multiplexer" type="System.Resources.ResXFileRef, System.Windows.Forms"> 137 140 <value>..\resources\multiplexer.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/Artificial Ant.txt
r9519 r9846 188 188 189 189 TERMINALS 190 Left<<>> CONSTRAINTS . 191 Right<<>> CONSTRAINTS . 192 Move<<>> CONSTRAINTS . 190 Left. Right. Move. 193 191 194 192 RULES … … 197 195 | Prog2<<world, state>> 198 196 | Prog3<<world, state>> 199 | Left <<>>SEM << state.TurnLeft(); >>200 | Right <<>>SEM << state.TurnRight(); >>201 | Move <<>>SEM << state.MoveForward(); >>197 | Left SEM << state.TurnLeft(); >> 198 | Right SEM << state.TurnRight(); >> 199 | Move SEM << state.MoveForward(); >> 202 200 . 203 201 … … 229 227 return (double)state.FoodEaten; 230 228 >> 231 END Arti tificialAnt.229 END ArtificialAnt. -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/GPDef.atg
r9844 r9846 28 28 29 29 COMPILER GPDef 30 public HeuristicLab.Optimization.I Problem problem;30 public HeuristicLab.Optimization.ISingleObjectiveHeuristicOptimizationProblem problem; 31 31 32 32 CHARACTERS -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/Parser.cs
r9844 r9846 28 28 int errDist = minErrDist; 29 29 30 public HeuristicLab.Optimization.I Problem problem;30 public HeuristicLab.Optimization.ISingleObjectiveHeuristicOptimizationProblem problem; 31 31 32 32 -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL/3.4/ProblemGenerator.cs
r9842 r9846 397 397 } 398 398 399 public I Problem GenerateFromAst(GPDefNode definition) {399 public ISingleObjectiveHeuristicOptimizationProblem GenerateFromAst(GPDefNode definition) { 400 400 problemSourceCode.AppendLine(usings); 401 401 … … 447 447 AppDomain.CurrentDomain.Load(asm.GetName()); 448 448 var problem = Activator.CreateInstance(asm.FullName, definition.Name + "." + definition.Name + "Problem").Unwrap(); 449 return ( HeuristicLab.Optimization.IProblem)problem;449 return (ISingleObjectiveHeuristicOptimizationProblem)problem; 450 450 } 451 451 } -
branches/HeuristicLab.Problems.GPDL/Test/Test.csproj
r9844 r9846 57 57 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 58 58 <Private>True</Private> 59 </Reference> 60 <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 61 <SpecificVersion>False</SpecificVersion> 62 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 59 63 </Reference> 60 64 <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4"> -
branches/HeuristicLab.Problems.GPDL/Test/TestGpdlExamples.cs
r9843 r9846 24 24 using System.Linq; 25 25 using System.Text; 26 using System.Threading; 27 using HeuristicLab.Algorithms.GeneticAlgorithm; 26 28 using HeuristicLab.Problems.GPDL; 27 29 using HeuristicLab.Problems.GPDL.Views; 30 using HeuristicLab.SequentialEngine; 28 31 using Microsoft.VisualStudio.TestTools.UnitTesting; 29 32 … … 39 42 parser.Parse(); 40 43 Assert.IsNotNull(parser.problem); 44 45 // test: run one generation 46 var ga = new GeneticAlgorithm(); 47 ga.Engine = new SequentialEngine(); 48 ga.PopulationSize.Value = 100; 49 ga.MaximumGenerations.Value = 1; 50 ga.Problem = parser.problem; 51 52 var wh = new AutoResetEvent(false); 53 Exception e = null; 54 ga.ExceptionOccurred += (sender, args) => { 55 e = args.Value; 56 wh.Set(); 57 }; 58 ga.Stopped += (sender, args) => { wh.Set(); }; 59 ga.Start(); 60 wh.WaitOne(); 61 if (e != null) Assert.Fail(e.Message, e); 41 62 } 42 63 }
Note: See TracChangeset
for help on using the changeset viewer.