Changeset 2852 for trunk/sources
- Timestamp:
- 02/23/10 06:50:50 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 18 added
- 3 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab 3.3.sln
r2836 r2852 58 58 {72104A0B-90E7-42F3-9ABE-9BBBADD4B943} = {72104A0B-90E7-42F3-9ABE-9BBBADD4B943} 59 59 {25087811-F74C-4128-BC86-8324271DA13E} = {25087811-F74C-4128-BC86-8324271DA13E} 60 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2} = {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2} 60 61 {E226881D-315F-423D-B419-A766FE0D8685} = {E226881D-315F-423D-B419-A766FE0D8685} 62 {14AB8D24-25BC-400C-A846-4627AA945192} = {14AB8D24-25BC-400C-A846-4627AA945192} 61 63 {C36BD924-A541-4A00-AFA8-41701378DDC5} = {C36BD924-A541-4A00-AFA8-41701378DDC5} 62 64 {1849A92E-DCFC-4E05-BB0A-D7B7A3DAFCFB} = {1849A92E-DCFC-4E05-BB0A-D7B7A3DAFCFB} … … 71 73 {56F9106A-079F-4C61-92F6-86A84C2D84B7} = {56F9106A-079F-4C61-92F6-86A84C2D84B7} 72 74 {DC3D7072-7999-4719-B65D-3997744D5DC1} = {DC3D7072-7999-4719-B65D-3997744D5DC1} 75 {F42F3576-7233-4B28-90F7-36AE15F30F92} = {F42F3576-7233-4B28-90F7-36AE15F30F92} 73 76 {57F38579-409D-4DD8-AB19-3F2C4A665126} = {57F38579-409D-4DD8-AB19-3F2C4A665126} 74 77 {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {BF7D9494-A586-457B-8DF9-ED599F9E6A71} … … 77 80 {958B43BC-CC5C-4FA2-8628-2B3B01D890B6} = {958B43BC-CC5C-4FA2-8628-2B3B01D890B6} 78 81 {AB687BBE-1BFE-476B-906D-44237135431D} = {AB687BBE-1BFE-476B-906D-44237135431D} 82 {4C3305C4-E440-4EAD-B218-68D77AE51543} = {4C3305C4-E440-4EAD-B218-68D77AE51543} 79 83 {DF2E61C4-A76D-4315-9D0B-53A077B1AC2C} = {DF2E61C4-A76D-4315-9D0B-53A077B1AC2C} 84 {4D59BEC9-A69E-4686-B8C9-0E6C073B093E} = {4D59BEC9-A69E-4686-B8C9-0E6C073B093E} 80 85 {102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B} = {102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B} 81 86 {EE2034D9-6E27-48A1-B855-42D45F69A4FC} = {EE2034D9-6E27-48A1-B855-42D45F69A4FC} 82 87 {1B3063DB-D71C-4A6A-A359-883E8F53A140} = {1B3063DB-D71C-4A6A-A359-883E8F53A140} 88 {35A42EE0-A896-4D7A-A99F-8ED9E925F320} = {35A42EE0-A896-4D7A-A99F-8ED9E925F320} 83 89 {AE5B1CE5-9862-4D6F-A700-D72CD9AEA295} = {AE5B1CE5-9862-4D6F-A700-D72CD9AEA295} 84 90 {A9E282EA-180F-4233-B809-AEDF0787545C} = {A9E282EA-180F-4233-B809-AEDF0787545C} … … 157 163 EndProject 158 164 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Permutation-3.3.Tests", "HeuristicLab.Permutation\3.3\Tests\HeuristicLab.Permutation-3.3.Tests.csproj", "{4D59BEC9-A69E-4686-B8C9-0E6C073B093E}" 165 EndProject 166 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.SGA.Views-3.3", "HeuristicLab.SGA.Views\3.3\HeuristicLab.SGA.Views-3.3.csproj", "{35A42EE0-A896-4D7A-A99F-8ED9E925F320}" 159 167 EndProject 160 168 Global … … 705 713 {4D59BEC9-A69E-4686-B8C9-0E6C073B093E}.Release|x64.ActiveCfg = Release|Any CPU 706 714 {4D59BEC9-A69E-4686-B8C9-0E6C073B093E}.Release|x86.ActiveCfg = Release|Any CPU 715 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 716 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Debug|Any CPU.Build.0 = Debug|Any CPU 717 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Debug|x64.ActiveCfg = Debug|Any CPU 718 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Debug|x86.ActiveCfg = Debug|Any CPU 719 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|Any CPU.ActiveCfg = Release|Any CPU 720 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|Any CPU.Build.0 = Release|Any CPU 721 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|x64.ActiveCfg = Release|Any CPU 722 {35A42EE0-A896-4D7A-A99F-8ED9E925F320}.Release|x86.ActiveCfg = Release|Any CPU 707 723 EndGlobalSection 708 724 GlobalSection(SolutionProperties) = preSolution -
trunk/sources/HeuristicLab 3.3/Files.txt
r2834 r2852 38 38 HeuristicLab.SequentialEngine\3.3:HeuristicLab.SequentialEngine-3.3.dll 39 39 HeuristicLab.SGA\3.3:HeuristicLab.SGA-3.3.dll 40 HeuristicLab.SGA.Views\3.3:HeuristicLab.SGA.Views-3.3.dll 40 41 HeuristicLab.TestFunctions\3.3:HeuristicLab.TestFunctions-3.3.dll 41 42 HeuristicLab.ThreadParallelEngine\3.3:HeuristicLab.ThreadParallelEngine-3.3.dll -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IDeepCloneable.cs
r2790 r2852 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 26 24 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IItem.cs
r2790 r2852 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.ComponentModel;25 using System.Text;26 22 using System.Drawing; 27 23 -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/ILookupParameter.cs
r2796 r2852 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 23 27 24 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/INamedItem.cs
r2790 r2852 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 23 using HeuristicLab.Common; 27 24 -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IRandom.cs
r2790 r2852 19 19 */ 20 20 #endregion 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using HeuristicLab.Core;26 21 27 22 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IScope.cs
r2790 r2852 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Collections;28 29 22 namespace HeuristicLab.Core { 30 23 /// <summary> -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IValueLookupParameter.cs
r2796 r2852 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 27 22 namespace HeuristicLab.Core { 28 23 public interface IValueLookupParameter : IValueParameter, ILookupParameter { } -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IValueParameter.cs
r2796 r2852 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 23 27 24 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IVariable.cs
r2790 r2852 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 using System.Xml;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Common;28 23 29 24 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs
r2833 r2852 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Drawing; 23 25 using System.Linq; 24 using System.Collections; 25 using System.Collections.Generic; 26 using System.Collections.ObjectModel; 27 using System.Text; 28 using System.Drawing; 26 using HeuristicLab.Collections; 27 using HeuristicLab.Common.Resources; 29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Common.Resources;31 using HeuristicLab.Collections;32 33 29 34 30 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r2851 r2852 27 27 using HeuristicLab.Persistence.Default.Xml; 28 28 29 namespace HeuristicLab.Optimization.Views { 29 namespace HeuristicLab.Optimization.Views { 30 30 /// <summary> 31 31 /// The base class for visual representations of items. … … 167 167 problemTypeSelectorDialog = new TypeSelectorDialog(); 168 168 problemTypeSelectorDialog.Caption = "Select Problem"; 169 problemTypeSelectorDialog.TypeSelector.Configure( typeof(IProblem), false, false);169 problemTypeSelectorDialog.TypeSelector.Configure(Content.ProblemType, false, false); 170 170 } 171 171 if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { … … 184 184 } 185 185 if (problem == null) 186 MessageBox.Show(this, "Selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 186 MessageBox.Show(this, "The selected file does not contain a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 187 else if (!Content.ProblemType.IsInstanceOfType(problem)) 188 MessageBox.Show(this, "The selected file contains a problem type which is not supported by this algorithm.", "Invalid Problem Type", MessageBoxButtons.OK, MessageBoxIcon.Error); 187 189 else 188 190 Content.Problem = problem; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs
r2851 r2852 26 26 using HeuristicLab.MainForm; 27 27 28 namespace HeuristicLab.Optimization.Views { 28 namespace HeuristicLab.Optimization.Views { 29 29 /// <summary> 30 30 /// The base class for visual representations of items. -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ProblemView.cs
r2851 r2852 23 23 using HeuristicLab.MainForm; 24 24 25 namespace HeuristicLab.Optimization.Views { 25 namespace HeuristicLab.Optimization.Views { 26 26 /// <summary> 27 27 /// The base class for visual representations of items. -
trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs
r2851 r2852 27 27 using HeuristicLab.Persistence.Default.Xml; 28 28 29 namespace HeuristicLab.Optimization.Views { 29 namespace HeuristicLab.Optimization.Views { 30 30 /// <summary> 31 31 /// The base class for visual representations of items. … … 94 94 } 95 95 if (operatorGraph == null) 96 MessageBox.Show(this, " Selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);96 MessageBox.Show(this, "The selected file does not contain an operator graph.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error); 97 97 else 98 98 Content.OperatorGraph = operatorGraph; -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r2851 r2852 36 36 } 37 37 38 public virtual Type ProblemType { 39 get { return typeof(IProblem); } 40 } 41 38 42 private IProblem problem; 39 43 [Storable] … … 42 46 set { 43 47 if (problem != value) { 44 if (problem != null) problem.Changed -= new ChangedEventHandler(Problem_Changed); 48 if ((value != null) && !ProblemType.IsInstanceOfType(value)) throw new ArgumentException("Invalid problem type."); 49 if (problem != null) DeregisterProblemEvents(); 45 50 problem = value; 46 if (problem != null) problem.Changed += new ChangedEventHandler(Problem_Changed);51 if (problem != null) RegisterProblemEvents(); 47 52 OnProblemChanged(); 48 53 } … … 135 140 ExceptionOccurred(this, new EventArgs<Exception>(exception)); 136 141 } 142 protected virtual void DeregisterProblemEvents() { 143 problem.SolutionCreatorChanged -= new EventHandler(Problem_SolutionCreatorChanged); 144 problem.EvaluatorChanged -= new EventHandler(Problem_EvaluatorChanged); 145 problem.Changed -= new ChangedEventHandler(Problem_Changed); 146 } 147 protected virtual void RegisterProblemEvents() { 148 problem.SolutionCreatorChanged += new EventHandler(Problem_SolutionCreatorChanged); 149 problem.EvaluatorChanged += new EventHandler(Problem_EvaluatorChanged); 150 problem.Changed += new ChangedEventHandler(Problem_Changed); 151 } 152 153 protected virtual void Problem_SolutionCreatorChanged(object sender, EventArgs e) { } 154 protected virtual void Problem_EvaluatorChanged(object sender, EventArgs e) { } 137 155 private void Problem_Changed(object sender, ChangedEventArgs e) { 138 156 OnChanged(e); -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r2851 r2852 52 52 <None Include="HeuristicLabOptimizationPlugin.cs.frame" /> 53 53 <Compile Include="Algorithm.cs" /> 54 <Compile Include="ISolutionCreator.cs" /> 55 <Compile Include="SingleObjectiveProblem.cs" /> 56 <Compile Include="ISingleObjectiveProblem.cs" /> 57 <Compile Include="IEvaluator.cs" /> 58 <Compile Include="ISingleObjectiveEvaluator.cs" /> 59 <Compile Include="SingleObjectiveEvaluator.cs" /> 54 60 <Compile Include="UserDefinedAlgorithm.cs" /> 55 61 <Compile Include="EngineAlgorithm.cs" /> … … 81 87 <Name>HeuristicLab.Core-3.3</Name> 82 88 </ProjectReference> 89 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 90 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 91 <Name>HeuristicLab.Data-3.3</Name> 92 </ProjectReference> 93 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 94 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 95 <Name>HeuristicLab.Operators-3.3</Name> 96 </ProjectReference> 97 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 98 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 99 <Name>HeuristicLab.Parameters-3.3</Name> 100 </ProjectReference> 83 101 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 84 102 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> -
trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLabOptimizationPlugin.cs.frame
r2845 r2852 32 32 [PluginDependency("HeuristicLab.Common.Resources", "3.2")] 33 33 [PluginDependency("HeuristicLab.Core", "3.3")] 34 [PluginDependency("HeuristicLab.Data", "3.3")] 35 [PluginDependency("HeuristicLab.Operators", "3.3")] 36 [PluginDependency("HeuristicLab.Parameters", "3.3")] 34 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] 35 38 public class HeuristicLabOptimizationPlugin : PluginBase { -
trunk/sources/HeuristicLab.Optimization/3.3/IAlgorithm.cs
r2851 r2852 29 29 /// </summary> 30 30 public interface IAlgorithm : IParameterizedNamedItem { 31 Type ProblemType { get; } 31 32 IProblem Problem { get; set; } 32 33 TimeSpan ExecutionTime { get; } -
trunk/sources/HeuristicLab.Optimization/3.3/IProblem.cs
r2845 r2852 21 21 22 22 using HeuristicLab.Core; 23 using System; 23 24 24 25 namespace HeuristicLab.Optimization { 25 26 /// <summary> 26 /// Interface to represent a problem.27 /// Interface to represent an optimization problem. 27 28 /// </summary> 28 public interface IProblem : IParameterizedNamedItem { } 29 public interface IProblem : IParameterizedNamedItem { 30 ISolutionCreator SolutionCreator { get; set; } 31 IEvaluator Evaluator { get; set; } 32 33 event EventHandler SolutionCreatorChanged; 34 event EventHandler EvaluatorChanged; 35 } 29 36 } -
trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs
r2851 r2852 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Parameters; 26 using System; 25 27 26 28 namespace HeuristicLab.Optimization { 27 29 /// <summary> 28 /// A base class for problems.30 /// A base class for optimization problems. 29 31 /// </summary> 30 [Item("Problem", "A base class for problems.")]32 [Item("Problem", "A base class for optimization problems.")] 31 33 [EmptyStorableClass] 32 34 public abstract class Problem : ParameterizedNamedItem, IProblem { … … 35 37 } 36 38 37 protected Problem() : base() { } 38 protected Problem(string name) : base(name) { } 39 protected Problem(string name, ParameterCollection parameters) : base(name, parameters) { } 40 protected Problem(string name, string description) : base(name, description) { } 41 protected Problem(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { } 39 private IValueParameter<ISolutionCreator> SolutionCreatorParameter { 40 get { return (IValueParameter<ISolutionCreator>)Parameters["SolutionCreator"]; } 41 } 42 private IValueParameter<IEvaluator> EvaluatorParameter { 43 get { return (IValueParameter<IEvaluator>)Parameters["Evaluator"]; } 44 } 45 public ISolutionCreator SolutionCreator { 46 get { return SolutionCreatorParameter.Value; } 47 set { SolutionCreatorParameter.Value = value; } 48 } 49 public IEvaluator Evaluator { 50 get { return EvaluatorParameter.Value; } 51 set { EvaluatorParameter.Value = value; } 52 } 53 54 protected Problem() 55 : base() { 56 AddParameters(); 57 } 58 protected Problem(string name) 59 : base(name) { 60 AddParameters(); 61 } 62 protected Problem(string name, ParameterCollection parameters) 63 : base(name, parameters) { 64 AddParameters(); 65 } 66 protected Problem(string name, string description) 67 : base(name, description) { 68 AddParameters(); 69 } 70 protected Problem(string name, string description, ParameterCollection parameters) 71 : base(name, description, parameters) { 72 AddParameters(); 73 } 74 75 private void AddParameters() { 76 ValueParameter<ISolutionCreator> solutionCreatorParameter = new ValueParameter<ISolutionCreator>("SolutionCreator", "The operator which should be used to create new solutions."); 77 solutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 78 Parameters.Add(solutionCreatorParameter); 79 80 ValueParameter<IEvaluator> evaluatorParameter = new ValueParameter<IEvaluator>("Evaluator", "The operator which should be used to evaluate solutions."); 81 evaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 82 Parameters.Add(evaluatorParameter); 83 } 84 85 private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) { 86 OnSolutionCreatorChanged(); 87 } 88 private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) { 89 OnEvaluatorChanged(); 90 } 91 92 public event EventHandler SolutionCreatorChanged; 93 protected virtual void OnSolutionCreatorChanged() { 94 if (SolutionCreatorChanged != null) 95 SolutionCreatorChanged(this, EventArgs.Empty); 96 } 97 public event EventHandler EvaluatorChanged; 98 protected virtual void OnEvaluatorChanged() { 99 if (EvaluatorChanged != null) 100 EvaluatorChanged(this, EventArgs.Empty); 101 } 42 102 } 43 103 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj
r2818 r2852 69 69 <ItemGroup> 70 70 <None Include="HeuristicLabParametersViewsPlugin.cs.frame" /> 71 <Compile Include="ConstrainedValueParameterView.cs"> 72 <SubType>UserControl</SubType> 73 </Compile> 74 <Compile Include="ConstrainedValueParameterView.Designer.cs"> 75 <DependentUpon>ConstrainedValueParameterView.cs</DependentUpon> 76 </Compile> 71 77 <Compile Include="ValueLookupParameterView.cs"> 72 78 <SubType>UserControl</SubType> … … 101 107 </ItemGroup> 102 108 <ItemGroup> 109 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 110 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 111 <Name>HeuristicLab.Collections-3.3</Name> 112 </ProjectReference> 103 113 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj"> 104 114 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> -
trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLabParametersViewsPlugin.cs.frame
r2818 r2852 28 28 [Plugin("HeuristicLab.Parameters.Views", "3.3.0.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Parameters.Views-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 30 31 [PluginDependency("HeuristicLab.Common", "3.2")] 31 32 [PluginDependency("HeuristicLab.Common.Resources", "3.2")] -
trunk/sources/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj
r2803 r2852 67 67 <ItemGroup> 68 68 <None Include="HeuristicLabParametersPlugin.cs.frame" /> 69 <Compile Include="ConstrainedValueParameter.cs" /> 69 70 <Compile Include="LookupParameter.cs" /> 70 71 <Compile Include="SubScopesLookupParameter.cs" /> -
trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs
r2834 r2852 108 108 return scope != null ? scope.Variables[actualName] : null; 109 109 } 110 //private IValueParameter GetProblemParameter(string name) {111 // IValueParameter param = null;112 // if (ExecutionContext.Problem.Parameters.ContainsKey(name)) {113 // param = ExecutionContext.Problem.Parameters[name] as IValueParameter;114 // if (param == null)115 // throw new InvalidOperationException(116 // string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".",117 // name,118 // typeof(IValueParameter).GetPrettyName())119 // );120 // }121 // return param;122 //}123 110 protected override IItem GetActualValue() { 124 111 string name; … … 130 117 IVariable var = LookupVariable(name); 131 118 if (var != null) { 132 T value = var.Value as T; 133 if (value == null) 119 if (!(var.Value is T)) 134 120 throw new InvalidOperationException( 135 121 string.Format("Type mismatch. Variable \"{0}\" does not contain a \"{1}\".", … … 137 123 typeof(T).GetPrettyName()) 138 124 ); 139 return va lue;125 return var.Value; 140 126 } 141 142 // try to get value from problem143 //IValueParameter problemParam = GetProblemParameter(name);144 //if (problemParam != null) return problemParam.Value;145 146 127 return null; 147 128 } 148 129 protected override void SetActualValue(IItem value) { 149 T val = value as T; 150 if (val == null) 130 if (!(value is T)) 151 131 throw new InvalidOperationException( 152 132 string.Format("Type mismatch. Value is not a \"{0}\".", … … 157 137 IValueParameter param = GetParameter(out name); 158 138 if (param != null) { 159 param.Value = val ;139 param.Value = value; 160 140 return; 161 141 } … … 164 144 IVariable var = LookupVariable(name); 165 145 if (var != null) { 166 var.Value = val ;146 var.Value = value; 167 147 return; 168 148 } 169 170 // try to set value in problem171 //IValueParameter problemParam = GetProblemParameter(name);172 //if (problemParam != null) {173 // problemParam.Value = val;174 // return;175 //}176 149 177 150 // create new variable -
trunk/sources/HeuristicLab.Parameters/3.3/SubScopesLookupParameter.cs
r2818 r2852 45 45 if (var != null) { 46 46 value = var.Value as T; 47 if ( value == null)47 if ((var.Value != null) && (value == null)) 48 48 throw new InvalidOperationException( 49 49 string.Format("Type mismatch. Variable \"{0}\" does not contain a \"{1}\".", -
trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r2818 r2852 48 48 set { 49 49 T val = value as T; 50 if ( val == null)50 if ((value != null) && (val == null)) 51 51 throw new InvalidOperationException( 52 52 string.Format("Type mismatch. Value is not a \"{0}\".", -
trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs
r2818 r2852 48 48 set { 49 49 T val = value as T; 50 if ( val == null)50 if ((value != null) && (val == null)) 51 51 throw new InvalidOperationException( 52 52 string.Format("Type mismatch. Value is not a \"{0}\".", -
trunk/sources/HeuristicLab.Permutation/3.3/HeuristicLab.Permutation-3.3.csproj
r2829 r2852 121 121 <Name>HeuristicLab.Operators-3.3</Name> 122 122 </ProjectReference> 123 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 124 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 125 <Name>HeuristicLab.Optimization-3.3</Name> 126 </ProjectReference> 123 127 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 124 128 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> -
trunk/sources/HeuristicLab.Permutation/3.3/HeuristicLabPermutationPlugin.cs.frame
r2794 r2852 33 33 [PluginDependency("HeuristicLab.Data", "3.3")] 34 34 [PluginDependency("HeuristicLab.Operators", "3.3")] 35 [PluginDependency("HeuristicLab.Optimization", "3.3")] 35 36 [PluginDependency("HeuristicLab.Parameters", "3.3")] 36 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
trunk/sources/HeuristicLab.Permutation/3.3/RandomPermutationCreator.cs
r2834 r2852 23 23 using HeuristicLab.Data; 24 24 using HeuristicLab.Operators; 25 using HeuristicLab.Optimization; 25 26 using HeuristicLab.Parameters; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 33 34 [EmptyStorableClass] 34 35 [Creatable("Test")] 35 public sealed class RandomPermutationCreator : SingleSuccessorOperator {36 public LookupParameter<IRandom> RandomParameter {36 public sealed class RandomPermutationCreator : SingleSuccessorOperator, ISolutionCreator { 37 public ILookupParameter<IRandom> RandomParameter { 37 38 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 38 39 } -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSP.cs
r2834 r2852 31 31 [Creatable("Problems")] 32 32 [EmptyStorableClass] 33 public sealed class TSP : Problem {33 public sealed class TSP : SingleObjectiveProblem { 34 34 private ValueParameter<DoubleMatrixData> CoordinatesParameter { 35 35 get { return (ValueParameter<DoubleMatrixData>)Parameters["Coordinates"]; } 36 }37 private OperatorParameter SolutionCreatorParameter {38 get { return (OperatorParameter)Parameters["SolutionCreator"]; }39 }40 private OperatorParameter SolutionEvaluatorParameter {41 get { return (OperatorParameter)Parameters["SolutionEvaluator"]; }42 36 } 43 37 … … 46 40 set { CoordinatesParameter.Value = value; } 47 41 } 48 public IOperator SolutionCreator {49 get { return SolutionCreatorParameter.Value; }50 set { SolutionCreatorParameter.Value = value; }51 }52 public IOperator SolutionEvaluator {53 get { return SolutionEvaluatorParameter.Value; }54 set { SolutionEvaluatorParameter.Value = value; }55 }56 42 57 43 public TSP() 58 44 : base() { 59 Parameters.Add(new ValueParameter<BoolData>("Maximization", "Set to false as the TSP is a minimization problem.", new BoolData(false)));45 Maximization = new BoolData(false); 60 46 Parameters.Add(new ValueParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.", new DoubleMatrixData(0, 0))); 61 47 Parameters.Add(new ValueParameter<DoubleData>("BestKnownQuality", "The quality of the best known solution of this TSP instance.")); 62 Parameters.Add(new OperatorParameter("SolutionCreator", "The operator which should be used to create new solutions.")); 63 Parameters.Add(new OperatorParameter("SolutionEvaluator", "The operator which should be used to evaluate solutions.")); 48 RandomPermutationCreator creator = new RandomPermutationCreator(); 49 creator.LengthParameter.Value = new IntData(0); 50 SolutionCreator = creator; 51 Evaluator = new TSPRoundedEuclideanPathEvaluator(); 64 52 } 65 53 … … 73 61 SolutionCreator = creator; 74 62 TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator(); 75 SolutionEvaluator = evaluator;63 Evaluator = evaluator; 76 64 } 77 65 } -
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPPathEvaluator.cs
r2834 r2852 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Data; 24 using HeuristicLab.Op erators;24 using HeuristicLab.Optimization; 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 32 32 [Item("TSPPathEvaluator", "A base class for operators which evaluate TSP solutions given in path representation.")] 33 33 [EmptyStorableClass] 34 public abstract class TSPPathEvaluator : Single SuccessorOperator {34 public abstract class TSPPathEvaluator : SingleObjectiveEvaluator { 35 35 public LookupParameter<DoubleMatrixData> CoordinatesParameter { 36 36 get { return (LookupParameter<DoubleMatrixData>)Parameters["Coordinates"]; } … … 39 39 get { return (LookupParameter<Permutation.Permutation>)Parameters["Permutation"]; } 40 40 } 41 public LookupParameter<DoubleData> QualityParameter {42 get { return (LookupParameter<DoubleData>)Parameters["Quality"]; }43 }44 41 45 42 protected TSPPathEvaluator() … … 47 44 Parameters.Add(new LookupParameter<DoubleMatrixData>("Coordinates", "The x- and y-Coordinates of the cities.")); 48 45 Parameters.Add(new LookupParameter<Permutation.Permutation>("Permutation", "The TSP solution given in path representation which should be evaluated.")); 49 Parameters.Add(new LookupParameter<DoubleData>("Quality", "The evaluated quality of the given TSP solution."));50 46 } 51 47 -
trunk/sources/HeuristicLab.SGA/3.3/SGA.cs
r2851 r2852 20 20 #endregion 21 21 22 using System;23 22 using HeuristicLab.Core; 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;25 using HeuristicLab.Collections;26 using HeuristicLab.Parameters;27 23 using HeuristicLab.Data; 24 using HeuristicLab.Evolutionary; 28 25 using HeuristicLab.Operators; 29 26 using HeuristicLab.Optimization; 30 using HeuristicLab.Evolutionary; 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using System; 31 30 32 31 namespace HeuristicLab.SGA { … … 36 35 [Item("SGA", "A standard genetic algorithm.")] 37 36 [Creatable("Algorithms")] 38 [EmptyStorableClass]39 37 public sealed class SGA : EngineAlgorithm { 38 [Storable] 39 private PopulationCreator populationCreator; 40 [Storable] 41 private SGAOperator sgaOperator; 42 43 public override Type ProblemType { 44 get { return typeof(ISingleObjectiveProblem); } 45 } 46 public new ISingleObjectiveProblem Problem { 47 get { return (ISingleObjectiveProblem)base.Problem; } 48 set { base.Problem = value; } 49 } 50 40 51 public new IScope GlobalScope { 41 52 get { return base.GlobalScope; } … … 44 55 public SGA() 45 56 : base() { 46 // Parameters.Add(new ValueLookupParameter<BoolData>("Maximization", "True if the problem is a maximization problem, otherwise false."));47 // Parameters.Add(new SubScopesLookupParameter<DoubleData>("Quality", "The value which represents the quality of a solution."));48 57 Parameters.Add(new ValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0))); 49 58 Parameters.Add(new ValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true))); … … 52 61 Parameters.Add(new ValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05))); 53 62 Parameters.Add(new OperatorParameter("MutationOperator", "The operator used to mutate solutions.")); 54 // Parameters.Add(new ValueLookupParameter<IOperator>("SolutionEvaluator", "The operator used to evaluate solutions."));55 63 Parameters.Add(new ValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1))); 56 64 Parameters.Add(new ValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000))); 57 65 58 66 RandomCreator randomCreator = new RandomCreator(); 59 PopulationCreatorpopulationCreator = new PopulationCreator();60 SGAOperatorsgaOperator = new SGAOperator();67 populationCreator = new PopulationCreator(); 68 sgaOperator = new SGAOperator(); 61 69 62 70 randomCreator.RandomParameter.ActualName = "Random"; … … 69 77 populationCreator.PopulationSizeParameter.ActualName = "PopulationSize"; 70 78 populationCreator.PopulationSizeParameter.Value = null; 71 populationCreator.SolutionCreatorParameter.ActualName = "SolutionCreator";72 populationCreator.SolutionEvaluatorParameter.ActualName = "SolutionEvaluator";73 79 populationCreator.Successor = sgaOperator; 74 80 75 81 sgaOperator.CrossoverOperatorParameter.ActualName = "CrossoverOperator"; 76 82 sgaOperator.ElitesParameter.ActualName = "Elites"; 77 sgaOperator.MaximizationParameter.ActualName = "Maximization";78 83 sgaOperator.MaximumGenerationsParameter.ActualName = "MaximumGenerations"; 79 84 sgaOperator.MutationOperatorParameter.ActualName = "MutationOperator"; 80 85 sgaOperator.MutationProbabilityParameter.ActualName = "MutationProbability"; 81 sgaOperator.QualityParameter.ActualName = "Quality";82 86 sgaOperator.RandomParameter.ActualName = "Random"; 83 sgaOperator.SolutionEvaluatorParameter.ActualName = "SolutionEvaluator";84 87 85 88 OperatorGraph.InitialOperator = randomCreator; 86 89 } 90 91 public override IDeepCloneable Clone(Cloner cloner) { 92 SGA clone = (SGA)base.Clone(cloner); 93 clone.populationCreator = (PopulationCreator)cloner.Clone(populationCreator); 94 clone.sgaOperator = (SGAOperator)cloner.Clone(sgaOperator); 95 return clone; 96 } 97 98 protected override void DeregisterProblemEvents() { 99 Problem.MaximizationChanged -= new EventHandler(Problem_MaximizationChanged); 100 base.DeregisterProblemEvents(); 101 } 102 protected override void RegisterProblemEvents() { 103 base.RegisterProblemEvents(); 104 Problem.MaximizationChanged += new EventHandler(Problem_MaximizationChanged); 105 } 106 107 protected override void OnProblemChanged() { 108 Problem.SolutionCreator.RandomParameter.ActualName = "Random"; 109 populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator; 110 populationCreator.SolutionEvaluatorParameter.Value = Problem.Evaluator; 111 sgaOperator.MaximizationParameter.Value = Problem.Maximization; 112 sgaOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.Name; 113 sgaOperator.SolutionEvaluatorParameter.Value = Problem.Evaluator; 114 base.OnProblemChanged(); 115 } 116 protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) { 117 Problem.SolutionCreator.RandomParameter.ActualName = "Random"; 118 populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator; 119 base.Problem_SolutionCreatorChanged(sender, e); 120 } 121 protected override void Problem_EvaluatorChanged(object sender, EventArgs e) { 122 populationCreator.SolutionEvaluatorParameter.Value = Problem.Evaluator; 123 sgaOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.Name; 124 sgaOperator.SolutionEvaluatorParameter.Value = Problem.Evaluator; 125 base.Problem_EvaluatorChanged(sender, e); 126 } 127 private void Problem_MaximizationChanged(object sender, EventArgs e) { 128 sgaOperator.MaximizationParameter.Value = Problem.Maximization; 129 } 87 130 } 88 131 }
Note: See TracChangeset
for help on using the changeset viewer.