Changeset 3198
- Timestamp:
- 03/23/10 02:14:26 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm.Views/3.3/GeneticAlgorithmView.Designer.cs
r3196 r3198 21 21 22 22 namespace HeuristicLab.Algorithms.GeneticAlgorithm.Views { 23 partial class SGAView {23 partial class GeneticAlgorithmView { 24 24 /// <summary> 25 25 /// Required designer variable. … … 143 143 this.descriptionTextBox.Size = new System.Drawing.Size(672, 20); 144 144 // 145 // SGAView145 // GeneticAlgorithmView 146 146 // 147 147 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 148 148 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 149 this.Name = " SGAView";149 this.Name = "GeneticAlgorithmView"; 150 150 this.Size = new System.Drawing.Size(744, 576); 151 151 this.engineTabPage.ResumeLayout(false); -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm.Views/3.3/GeneticAlgorithmView.cs
r3196 r3198 27 27 /// The base class for visual representations of items. 28 28 /// </summary> 29 [View(" SGAView")]30 [Content(typeof( SGA), true)]31 public sealed partial class SGAView : EngineAlgorithmView {32 public new SGAContent {33 get { return ( SGA)base.Content; }29 [View("Genetic Algorithm View")] 30 [Content(typeof(GeneticAlgorithm), true)] 31 public sealed partial class GeneticAlgorithmView : EngineAlgorithmView { 32 public new GeneticAlgorithm Content { 33 get { return (GeneticAlgorithm)base.Content; } 34 34 set { base.Content = value; } 35 35 } … … 38 38 /// Initializes a new instance of <see cref="ItemBaseView"/>. 39 39 /// </summary> 40 public SGAView() {40 public GeneticAlgorithmView() { 41 41 InitializeComponent(); 42 42 } … … 45 45 /// </summary> 46 46 /// <param name="item">The item that should be displayed.</param> 47 public SGAView(SGAcontent)47 public GeneticAlgorithmView(GeneticAlgorithm content) 48 48 : this() { 49 49 Content = content; -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm.Views/3.3/HeuristicLab.Algorithms.GeneticAlgorithm.Views-3.3.csproj
r3196 r3198 85 85 </ItemGroup> 86 86 <ItemGroup> 87 <Compile Include="HeuristicLabAlgorithmsGeneticAlgorithmViewsPlugin.cs" /> 88 <Compile Include="SGAView.cs"> 87 <Compile Include="GeneticAlgorithmView.cs"> 89 88 <SubType>UserControl</SubType> 90 89 </Compile> 91 <Compile Include=" SGAView.Designer.cs">92 <DependentUpon> SGAView.cs</DependentUpon>90 <Compile Include="GeneticAlgorithmView.Designer.cs"> 91 <DependentUpon>GeneticAlgorithmView.cs</DependentUpon> 93 92 </Compile> 93 <Compile Include="HeuristicLabAlgorithmsGeneticAlgorithmViewsPlugin.cs" /> 94 94 <Compile Include="Properties\AssemblyInfo.cs" /> 95 95 </ItemGroup> -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r3196 r3198 34 34 namespace HeuristicLab.Algorithms.GeneticAlgorithm { 35 35 /// <summary> 36 /// A standardgenetic algorithm.36 /// A genetic algorithm. 37 37 /// </summary> 38 [Item(" SGA", "A standardgenetic algorithm.")]38 [Item("Genetic Algorithm", "A genetic algorithm.")] 39 39 [Creatable("Algorithms")] 40 40 [StorableClass] 41 public sealed class SGA: EngineAlgorithm {41 public sealed class GeneticAlgorithm : EngineAlgorithm { 42 42 #region Problem Properties 43 43 public override Type ProblemType { … … 123 123 get { return (SolutionsCreator)RandomCreator.Successor; } 124 124 } 125 private SGAMainLoop SGAMainLoop {126 get { return ( SGAMainLoop)SolutionsCreator.Successor; }125 private GeneticAlgorithmMainLoop GeneticAlgorithmMainLoop { 126 get { return (GeneticAlgorithmMainLoop)SolutionsCreator.Successor; } 127 127 } 128 128 private List<ISelector> selectors; … … 132 132 #endregion 133 133 134 public SGA()134 public GeneticAlgorithm() 135 135 : base() { 136 136 Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); … … 146 146 RandomCreator randomCreator = new RandomCreator(); 147 147 SolutionsCreator solutionsCreator = new SolutionsCreator(); 148 SGAMainLoop sgaMainLoop = new SGAMainLoop();148 GeneticAlgorithmMainLoop geneticAlgorithmMainLoop = new GeneticAlgorithmMainLoop(); 149 149 OperatorGraph.InitialOperator = randomCreator; 150 150 … … 157 157 158 158 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 159 solutionsCreator.Successor = sgaMainLoop;160 161 sgaMainLoop.SelectorParameter.ActualName = SelectorParameter.Name;162 sgaMainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;163 sgaMainLoop.ElitesParameter.ActualName = ElitesParameter.Name;164 sgaMainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;165 sgaMainLoop.MutatorParameter.ActualName = MutatorParameter.Name;166 sgaMainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;167 sgaMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;168 sgaMainLoop.ResultsParameter.ActualName = "Results";159 solutionsCreator.Successor = geneticAlgorithmMainLoop; 160 161 geneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name; 162 geneticAlgorithmMainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name; 163 geneticAlgorithmMainLoop.ElitesParameter.ActualName = ElitesParameter.Name; 164 geneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name; 165 geneticAlgorithmMainLoop.MutatorParameter.ActualName = MutatorParameter.Name; 166 geneticAlgorithmMainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 167 geneticAlgorithmMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 168 geneticAlgorithmMainLoop.ResultsParameter.ActualName = "Results"; 169 169 170 170 Initialze(); 171 171 } 172 172 [StorableConstructor] 173 private SGA(bool deserializing) : base() { }173 private GeneticAlgorithm(bool deserializing) : base() { } 174 174 175 175 public override IDeepCloneable Clone(Cloner cloner) { 176 SGA clone = (SGA)base.Clone(cloner);176 GeneticAlgorithm clone = (GeneticAlgorithm)base.Clone(cloner); 177 177 clone.Initialze(); 178 178 return clone; … … 193 193 foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op); 194 194 ParameterizeSolutionsCreator(); 195 Parameterize SGAMainLoop();195 ParameterizeGeneticAlgorithmMainLoop(); 196 196 ParameterizeSelectors(); 197 197 UpdateCrossovers(); … … 210 210 ParameterizeStochasticOperator(Problem.Evaluator); 211 211 ParameterizeSolutionsCreator(); 212 Parameterize SGAMainLoop();212 ParameterizeGeneticAlgorithmMainLoop(); 213 213 ParameterizeSelectors(); 214 214 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); … … 217 217 protected override void Problem_VisualizerChanged(object sender, EventArgs e) { 218 218 ParameterizeStochasticOperator(Problem.Visualizer); 219 Parameterize SGAMainLoop();219 ParameterizeGeneticAlgorithmMainLoop(); 220 220 if (Problem.Visualizer != null) Problem.Visualizer.VisualizationParameter.ActualNameChanged += new EventHandler(Visualizer_VisualizationParameter_ActualNameChanged); 221 221 base.Problem_VisualizerChanged(sender, e); … … 242 242 } 243 243 private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) { 244 Parameterize SGAMainLoop();244 ParameterizeGeneticAlgorithmMainLoop(); 245 245 ParameterizeSelectors(); 246 246 } 247 247 private void Visualizer_VisualizationParameter_ActualNameChanged(object sender, EventArgs e) { 248 Parameterize SGAMainLoop();248 ParameterizeGeneticAlgorithmMainLoop(); 249 249 } 250 250 #endregion … … 271 271 SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name; 272 272 } 273 private void Parameterize SGAMainLoop() {274 SGAMainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;275 SGAMainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;276 SGAMainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;277 SGAMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;278 SGAMainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name;273 private void ParameterizeGeneticAlgorithmMainLoop() { 274 GeneticAlgorithmMainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 275 GeneticAlgorithmMainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name; 276 GeneticAlgorithmMainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 277 GeneticAlgorithmMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName; 278 GeneticAlgorithmMainLoop.VisualizerParameter.ActualName = Problem.VisualizerParameter.Name; 279 279 if (Problem.Visualizer != null) 280 SGAMainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName;280 GeneticAlgorithmMainLoop.VisualizationParameter.ActualName = Problem.Visualizer.VisualizationParameter.ActualName; 281 281 } 282 282 private void ParameterizeStochasticOperator(IOperator op) { -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs
r3196 r3198 31 31 namespace HeuristicLab.Algorithms.GeneticAlgorithm { 32 32 /// <summary> 33 /// An operator which represents the main loop of a standard genetic algorithm (SGA).33 /// An operator which represents the main loop of a genetic algorithm. 34 34 /// </summary> 35 [Item(" SGAMainLoop", "An operator which represents the main loop of a standard genetic algorithm (SGA).")]35 [Item("GeneticAlgorithmMainLoop", "An operator which represents the main loop of a genetic algorithm.")] 36 36 [StorableClass] 37 public sealed class SGAMainLoop : AlgorithmOperator {37 public sealed class GeneticAlgorithmMainLoop : AlgorithmOperator { 38 38 #region Parameter properties 39 39 public ValueLookupParameter<IRandom> RandomParameter { … … 89 89 90 90 [StorableConstructor] 91 private SGAMainLoop(bool deserializing) : base() { }92 public SGAMainLoop()91 private GeneticAlgorithmMainLoop(bool deserializing) : base() { } 92 public GeneticAlgorithmMainLoop() 93 93 : base() { 94 94 Initialize(); … … 111 111 Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions.")); 112 112 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions.")); 113 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the SGAshould be applied."));113 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the genetic algorithm should be applied.")); 114 114 #endregion 115 115 -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/HeuristicLab.Algorithms.GeneticAlgorithm-3.3.csproj
r3196 r3198 82 82 </ItemGroup> 83 83 <ItemGroup> 84 <Compile Include="GeneticAlgorithm.cs" /> 85 <Compile Include="GeneticAlgorithmMainLoop.cs" /> 84 86 <Compile Include="HeuristicLabAlgorithmsGeneticAlgorithmPlugin.cs" /> 85 <Compile Include="SGA.cs">86 <SubType>Code</SubType>87 </Compile>88 87 <Compile Include="Properties\AssemblyInfo.cs" /> 89 <Compile Include="SGAMainLoop.cs" />90 88 </ItemGroup> 91 89 <ItemGroup> -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/Tests/HeuristicLab.Algorithms.GeneticAlgorithm-3.3.Tests.csproj
r3196 r3198 156 156 </ItemGroup> 157 157 <ItemGroup> 158 <None Include="SGA.hl"> 159 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 160 </None> 158 <None Include="GeneticAlgorithm.hl" /> 161 159 </ItemGroup> 162 160 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/Tests/Properties/AssemblyInfo.cs
r3196 r3198 7 7 // associated with an assembly. 8 8 [assembly: AssemblyTitle("HeuristicLab.Algorithms.GeneticAlgorithm-3.3.Tests")] 9 [assembly: AssemblyDescription("Unit tests for the HeuristicLab standard genetic algorithm (SGA)")]9 [assembly: AssemblyDescription("Unit tests for the HeuristicLab genetic algorithm")] 10 10 [assembly: AssemblyConfiguration("")] 11 11 [assembly: AssemblyCompany("")] -
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/Tests/UnitTest.cs
r3196 r3198 80 80 81 81 [TestMethod] 82 [DeploymentItem(@" SGA.hl")]83 public void SGAPerformanceTest() {82 [DeploymentItem(@"GeneticAlgorithm.hl")] 83 public void GeneticAlgorithmPerformanceTest() { 84 84 ex = null; 85 IAlgorithm sga = (IAlgorithm)XmlParser.Deserialize("SGA.hl");86 sga.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(sga_ExceptionOccurred);87 sga.Stopped += new EventHandler(sga_Stopped);88 sga.Prepare();89 sga.Start();85 IAlgorithm ga = (IAlgorithm)XmlParser.Deserialize("GeneticAlgorithm.hl"); 86 ga.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(ga_ExceptionOccurred); 87 ga.Stopped += new EventHandler(ga_Stopped); 88 ga.Prepare(); 89 ga.Start(); 90 90 trigger.WaitOne(); 91 TestContext.WriteLine("Runtime: {0}", sga.ExecutionTime.ToString());91 TestContext.WriteLine("Runtime: {0}", ga.ExecutionTime.ToString()); 92 92 if (ex != null) throw ex; 93 93 } 94 94 95 private void sga_ExceptionOccurred(object sender, EventArgs<Exception> e) {95 private void ga_ExceptionOccurred(object sender, EventArgs<Exception> e) { 96 96 ex = e.Value; 97 97 } 98 98 99 private void sga_Stopped(object sender, EventArgs e) {99 private void ga_Stopped(object sender, EventArgs e) { 100 100 trigger.Set(); 101 101 }
Note: See TracChangeset
for help on using the changeset viewer.