Changeset 10177
- Timestamp:
- 12/03/13 14:52:41 (11 years ago)
- Location:
- branches/DataAnalysis.IslandAlgorithms
- Files:
-
- 1 deleted
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.IslandAlgorithms
- Property svn:ignore
-
old new 1 1 *.suo 2 bin
-
- Property svn:ignore
-
branches/DataAnalysis.IslandAlgorithms/DataAnalysis.IslandAlgorithms.sln
r10142 r10177 15 15 EndProject 16 16 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3", "HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm\3.3\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.csproj", "{F409DD9E-1E9C-4EB1-AA3A-9F6E987C6E58}" 17 EndProject 18 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Tests", "HeuristicLab.Tests\HeuristicLab.Tests.csproj", "{F26EC1D3-4338-4F8B-AE5C-434D9256D580}" 17 19 EndProject 18 20 Global … … 70 72 {F409DD9E-1E9C-4EB1-AA3A-9F6E987C6E58}.Release|x86.ActiveCfg = Release|x86 71 73 {F409DD9E-1E9C-4EB1-AA3A-9F6E987C6E58}.Release|x86.Build.0 = Release|x86 74 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 75 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Debug|Any CPU.Build.0 = Debug|Any CPU 76 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Debug|x64.ActiveCfg = Debug|Any CPU 77 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Debug|x86.ActiveCfg = Debug|Any CPU 78 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Release|Any CPU.ActiveCfg = Release|Any CPU 79 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Release|Any CPU.Build.0 = Release|Any CPU 80 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Release|x64.ActiveCfg = Release|Any CPU 81 {F26EC1D3-4338-4F8B-AE5C-434D9256D580}.Release|x86.ActiveCfg = Release|Any CPU 72 82 EndGlobalSection 73 83 GlobalSection(SolutionProperties) = preSolution -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3
- Property svn:ignore
-
old new 1 *.user 1 2 Plugin.cs 2 3 bin
-
- Property svn:ignore
-
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/HeuristicLab.Algorithms.DataAnalysis.Symbolic.csproj
r10142 r10177 123 123 </ItemGroup> 124 124 <ItemGroup> 125 <Compile Include="ConsecutiveSamplesEvaluator.cs" /> 125 126 <Compile Include="SymbolicDataAnalysisIslandOffspringSelectionGeneticAlgorithm.cs" /> 126 <Compile Include="ISymbolicDataAnalysisIsland GAEvaluator .cs" />127 <Compile Include="ISymbolicDataAnalysisIslandAlgorithmEvaluator .cs" /> 127 128 <Compile Include="ScopeTreeAssigner.cs" /> 128 129 <Compile Include="Plugin.cs" /> 129 130 <Compile Include="Properties\AssemblyInfo.cs" /> 130 <Compile Include=" SymbolicDataAnalysisIslandGAEvaluator.cs" />131 <Compile Include="RandomSamplesEvaluator .cs" /> 131 132 <Compile Include="SymbolicDataAnalysisIslandGeneticAlgorithm.cs" /> 132 133 </ItemGroup> -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/ISymbolicDataAnalysisIslandAlgorithmEvaluator .cs
r10176 r10177 23 23 24 24 namespace HeuristicLab.Algorithms.DataAnalysis.Symbolic { 25 public interface ISymbolicDataAnalysisIslandG AEvaluator : ISingleObjectiveEvaluator {25 public interface ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator : ISingleObjectiveEvaluator { 26 26 } 27 27 } -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/RandomSamplesEvaluator .cs
r10156 r10177 34 34 namespace HeuristicLab.Algorithms.DataAnalysis.Symbolic { 35 35 [StorableClass] 36 public sealed class SymbolicDataAnalysisIslandGAEvaluator : SingleSuccessorOperator, IStochasticOperator, ISymbolicDataAnalysisIslandGAEvaluator {36 public sealed class RandomSamplesEvaluator : SingleSuccessorOperator, IStochasticOperator, ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator { 37 37 private const string RandomParameterName = "Random"; 38 38 private const string ProblemDataParameterName = "ProblemData"; … … 56 56 get { return (ILookupParameter<DoubleValue>)Parameters[QualityParameterName]; } 57 57 } 58 public I ValueLookupParameter<IntRange> FitnessCalculationPartitionParameter {59 get { return (I ValueLookupParameter<IntRange>)Parameters[FitnessCalculationPartitionParameterName]; }58 public ILookupParameter<IntRange> FitnessCalculationPartitionParameter { 59 get { return (ILookupParameter<IntRange>)Parameters[FitnessCalculationPartitionParameterName]; } 60 60 } 61 61 public ILookupParameter<IntRange> FixedSamplesPartitionParameter { 62 62 get { return (ILookupParameter<IntRange>)Parameters[FixedSamplesPartitionParameterName]; } 63 63 } 64 public ILookupParameter<IntValue> RandomSamplesParameter { 65 get { return (ILookupParameter<IntValue>)Parameters[RandomSamplesParameterName]; } 64 public IFixedValueParameter<IntValue> RandomSamplesParameter { 65 get { return (IFixedValueParameter<IntValue>)Parameters[RandomSamplesParameterName]; } 66 } 67 #endregion 68 69 #region properties 70 71 public int RandomSamples { 72 get { return RandomSamplesParameter.Value.Value; } 73 set { RandomSamplesParameter.Value.Value = value; } 66 74 } 67 75 #endregion 68 76 69 77 [StorableConstructor] 70 private SymbolicDataAnalysisIslandGAEvaluator(bool deserializing) : base(deserializing) { }71 private SymbolicDataAnalysisIslandGAEvaluator(SymbolicDataAnalysisIslandGAEvaluator original, Cloner cloner)78 private RandomSamplesEvaluator(bool deserializing) : base(deserializing) { } 79 private RandomSamplesEvaluator(RandomSamplesEvaluator original, Cloner cloner) 72 80 : base(original, cloner) { 73 81 } 74 82 public override IDeepCloneable Clone(Cloner cloner) { 75 return new SymbolicDataAnalysisIslandGAEvaluator(this, cloner);83 return new RandomSamplesEvaluator(this, cloner); 76 84 } 77 85 78 public SymbolicDataAnalysisIslandGAEvaluator()86 public RandomSamplesEvaluator() 79 87 : base() { 80 88 Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The random generator to use.")); … … 82 90 Parameters.Add(new LookupParameter<IOperator>(EvaluatorParameterName, "The evaluator provided by the symbolic data analysis problem.")); 83 91 Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The quality which is calculated by the encapsulated evaluator.")); 84 Parameters.Add(new ValueLookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "The data partition used to calculate the fitness"));92 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "The data partition used to calculate the fitness")); 85 93 Parameters.Add(new LookupParameter<IntRange>(FixedSamplesPartitionParameterName, "The data partition which is used to calculate the fitness on the fixed samples.")); 86 Parameters.Add(new LookupParameter<IntValue>(RandomSamplesParameterName, "The number of random samples used for fitness calculation in each island.")); 87 88 EvaluatorParameter.Hidden = true; 94 Parameters.Add(new FixedValueParameter<IntValue>(RandomSamplesParameterName, "The number of random samples used for fitness calculation in each island.", new IntValue())); 89 95 } 90 96 … … 95 101 var samples = FitnessCalculationPartitionParameter.ActualValue; 96 102 var fixedSamples = FixedSamplesPartitionParameter.ActualValue; 97 var randomSamples = RandomSamples Parameter.ActualValue.Value;103 var randomSamples = RandomSamples; 98 104 99 105 //create fixed rows enumerable -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/SymbolicDataAnalysisIslandGeneticAlgorithm.cs
r10156 r10177 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.Data; 29 using HeuristicLab.Operators; 29 30 using HeuristicLab.Optimization; 30 31 using HeuristicLab.Parameters; 31 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 33 using HeuristicLab.Problems.DataAnalysis.Symbolic; 33 using HeuristicLab.Random;34 34 35 35 namespace HeuristicLab.Algorithms.DataAnalysis.Symbolic { … … 41 41 private const string FixedSamplesPartitionParameterName = "FixedSamplesPartition"; 42 42 private const string FixedSamplesPartitionsParameterName = "FixedSamplesPartitions"; 43 private const string RandomSamplesParameterName = "NumberOfRandomSamples";44 43 private const string EvaluatorParameterName = "IslandEvaluator"; 44 private const string IslandIndexParameterName = "IslandIndex"; 45 45 private const string ProblemEvaluatorParameterName = "ProblemEvaluator"; 46 46 … … 62 62 get { return (IValueParameter<ItemArray<IntRange>>)Parameters[FixedSamplesPartitionsParameterName]; } 63 63 } 64 public IFixedValueParameter<IntValue> RandomSamplesParameter { 65 get { return (IFixedValueParameter<IntValue>)Parameters[RandomSamplesParameterName]; } 66 } 67 public IValueParameter<ISymbolicDataAnalysisIslandGAEvaluator> EvaluatorParameter { 68 get { return (IValueParameter<ISymbolicDataAnalysisIslandGAEvaluator>)Parameters[EvaluatorParameterName]; } 64 public IValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator> EvaluatorParameter { 65 get { return (IValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator>)Parameters[EvaluatorParameterName]; } 69 66 } 70 67 private ILookupParameter<ISingleObjectiveEvaluator> ProblemEvaluatorParameter { … … 81 78 get { return FixedSamplesPartitionsParameter.Value; } 82 79 set { FixedSamplesPartitionsParameter.Value = value; } 83 }84 public int RandomSamples {85 get { return RandomSamplesParameter.Value.Value; }86 set { RandomSamplesParameter.Value.Value = value; }87 80 } 88 81 #endregion … … 106 99 Parameters.Add(new FixedValueParameter<IntValue>(FixedSamplesParameterName, "The number of fixed samples used for fitness calculation in each island.", new IntValue(0))); 107 100 Parameters.Add(new ValueParameter<ItemArray<IntRange>>(FixedSamplesPartitionsParameterName, "The fixed samples partitions used for fitness calculation for every island.")); 108 Parameters.Add(new FixedValueParameter<IntValue>(RandomSamplesParameterName, "The number of random samples used for fitness calculation in each island.", new IntValue(0))); 109 Parameters.Add(new OptionalValueParameter<ISymbolicDataAnalysisIslandGAEvaluator>(EvaluatorParameterName, "The evaluator of the algorithm.")); 101 Parameters.Add(new OptionalValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator>(EvaluatorParameterName, "The evaluator of the algorithm.")); 110 102 Parameters.Add(new LookupParameter<ISingleObjectiveEvaluator>(ProblemEvaluatorParameterName, "Internal parameter for name translation", "Evaluator")); 103 104 ScopeTreeAssigner<IntValue> islandIndexAssigner = new ScopeTreeAssigner<IntValue>(); 105 islandIndexAssigner.Name = "Insert island index"; 106 islandIndexAssigner.LeftSideParameter.ActualName = IslandIndexParameterName; 107 var readonlyIslandIndexes = Enumerable.Range(0, NumberOfIslands.Value).Select(x => (IntValue)new IntValue(x).AsReadOnly()); 108 islandIndexAssigner.RightSideParameter.Value = new ItemArray<IntValue>(readonlyIslandIndexes); 111 109 112 110 ScopeTreeAssigner<IntRange> fixedSamplesPartitionCreator = new ScopeTreeAssigner<IntRange>(); … … 115 113 fixedSamplesPartitionCreator.RightSideParameter.ActualName = FixedSamplesPartitionsParameterName; 116 114 117 RandomCreator insertionPoint = OperatorGraph.Iterate().OfType<RandomCreator>().Skip(1).First(); 115 SubScopesCreator insertionPoint = OperatorGraph.Iterate().OfType<SubScopesCreator>().First(); 116 islandIndexAssigner.Successor = fixedSamplesPartitionCreator; 118 117 fixedSamplesPartitionCreator.Successor = insertionPoint.Successor; 119 insertionPoint.Successor = fixedSamplesPartitionCreator; 118 insertionPoint.Successor = islandIndexAssigner; 119 120 //RandomCreator insertionPoint = OperatorGraph.Iterate().OfType<RandomCreator>().Skip(1).First(); 121 //fixedSamplesPartitionCreator.Successor = insertionPoint.Successor; 122 //insertionPoint.Successor = fixedSamplesPartitionCreator; 120 123 121 124 RegisterParameterEvents(); … … 131 134 ReevaluateImmigrants = FixedSamples >= Problem.FitnessCalculationPartition.Size; 132 135 }; 133 RandomSamplesParameter.Value.ValueChanged += (o, e) => { ReevaluteElites = RandomSamples != 0; };134 136 Analyzer.Operators.PropertyChanged += (o, e) => ParameterizeAnalyzers(); 135 137 EvaluatorParameter.ValueChanged += (o, e) => ParameterizeEvaluator(); … … 160 162 private void ParameterizeEvaluator() { 161 163 var evaluator = EvaluatorParameter.Value; 162 var islandGAEvaluator = evaluator as SymbolicDataAnalysisIslandGAEvaluator; 163 if (islandGAEvaluator != null) { 164 islandGAEvaluator.RandomSamplesParameter.ActualName = RandomSamplesParameterName; 164 165 var randomEvaluator = evaluator as RandomSamplesEvaluator; 166 if (randomEvaluator != null) { 167 ReevaluteElites = randomEvaluator.RandomSamples != 0; 168 } 169 170 var consecutiveEvaluator = evaluator as ConsecutiveSamplesEvaluator; 171 if (consecutiveEvaluator != null) { 172 consecutiveEvaluator.DataMigrationIntervalParameter.ActualName = MigrationIntervalParameter.Name; 165 173 } 166 174 } … … 181 189 182 190 if (Problem != null && EvaluatorParameter.Value == null) { 183 EvaluatorParameter.Value = new SymbolicDataAnalysisIslandGAEvaluator();191 EvaluatorParameter.Value = new RandomSamplesEvaluator(); 184 192 } else if (Problem == null) 185 193 EvaluatorParameter.Value = null; -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.DataAnalysis.Symbolic/3.3/SymbolicDataAnalysisIslandOffspringSelectionGeneticAlgorithm.cs
r10156 r10177 41 41 private const string FixedSamplesPartitionParameterName = "FixedSamplesPartition"; 42 42 private const string FixedSamplesPartitionsParameterName = "FixedSamplesPartitions"; 43 private const string RandomSamplesParameterName = "NumberOfRandomSamples";44 43 private const string EvaluatorParameterName = "IslandEvaluator"; 44 private const string IslandIndexParameterName = "IslandIndex"; 45 45 private const string ProblemEvaluatorParameterName = "ProblemEvaluator"; 46 46 … … 62 62 get { return (IValueParameter<ItemArray<IntRange>>)Parameters[FixedSamplesPartitionsParameterName]; } 63 63 } 64 public IFixedValueParameter<IntValue> RandomSamplesParameter { 65 get { return (IFixedValueParameter<IntValue>)Parameters[RandomSamplesParameterName]; } 66 } 67 public IValueParameter<ISymbolicDataAnalysisIslandGAEvaluator> EvaluatorParameter { 68 get { return (IValueParameter<ISymbolicDataAnalysisIslandGAEvaluator>)Parameters[EvaluatorParameterName]; } 64 public IValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator> EvaluatorParameter { 65 get { return (IValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator>)Parameters[EvaluatorParameterName]; } 69 66 } 70 67 private ILookupParameter<ISingleObjectiveEvaluator> ProblemEvaluatorParameter { … … 81 78 get { return FixedSamplesPartitionsParameter.Value; } 82 79 set { FixedSamplesPartitionsParameter.Value = value; } 83 }84 public int RandomSamples {85 get { return RandomSamplesParameter.Value.Value; }86 set { RandomSamplesParameter.Value.Value = value; }87 80 } 88 81 #endregion … … 106 99 Parameters.Add(new FixedValueParameter<IntValue>(FixedSamplesParameterName, "The number of fixed samples used for fitness calculation in each island.", new IntValue(0))); 107 100 Parameters.Add(new ValueParameter<ItemArray<IntRange>>(FixedSamplesPartitionsParameterName, "The fixed samples partitions used for fitness calculation for every island.")); 108 Parameters.Add(new FixedValueParameter<IntValue>(RandomSamplesParameterName, "The number of random samples used for fitness calculation in each island.", new IntValue(0))); 109 Parameters.Add(new OptionalValueParameter<ISymbolicDataAnalysisIslandGAEvaluator>(EvaluatorParameterName, "The evaluator of the algorithm.")); 101 Parameters.Add(new OptionalValueParameter<ISymbolicDataAnalysisIslandGeneticAlgorithmEvaluator>(EvaluatorParameterName, "The evaluator of the algorithm.")); 110 102 Parameters.Add(new LookupParameter<ISingleObjectiveEvaluator>(ProblemEvaluatorParameterName, "Internal parameter for name translation", "Evaluator")); 103 104 ScopeTreeAssigner<IntValue> islandIndexAssigner = new ScopeTreeAssigner<IntValue>(); 105 islandIndexAssigner.Name = "Insert island index"; 106 islandIndexAssigner.LeftSideParameter.ActualName = IslandIndexParameterName; 107 var readonlyIslandIndexes = Enumerable.Range(0, NumberOfIslands.Value).Select(x => (IntValue)new IntValue(x).AsReadOnly()); 108 islandIndexAssigner.RightSideParameter.Value = new ItemArray<IntValue>(readonlyIslandIndexes); 111 109 112 110 ScopeTreeAssigner<IntRange> fixedSamplesPartitionCreator = new ScopeTreeAssigner<IntRange>(); … … 116 114 117 115 SubScopesCreator insertionPoint = OperatorGraph.Iterate().OfType<SubScopesCreator>().First(); 116 islandIndexAssigner.Successor = fixedSamplesPartitionCreator; 118 117 fixedSamplesPartitionCreator.Successor = insertionPoint.Successor; 119 insertionPoint.Successor = fixedSamplesPartitionCreator;118 insertionPoint.Successor = islandIndexAssigner; 120 119 121 120 RegisterParameterEvents(); … … 131 130 ReevaluateImmigrants = FixedSamples >= Problem.FitnessCalculationPartition.Size; 132 131 }; 133 RandomSamplesParameter.Value.ValueChanged += (o, e) => { ReevaluteElites = RandomSamples != 0; };134 132 Analyzer.Operators.PropertyChanged += (o, e) => ParameterizeAnalyzers(); 135 133 EvaluatorParameter.ValueChanged += (o, e) => ParameterizeEvaluator(); … … 160 158 private void ParameterizeEvaluator() { 161 159 var evaluator = EvaluatorParameter.Value; 162 var islandGAEvaluator = evaluator as SymbolicDataAnalysisIslandGAEvaluator; 163 if (islandGAEvaluator != null) { 164 islandGAEvaluator.RandomSamplesParameter.ActualName = RandomSamplesParameterName; 160 161 var randomEvaluator = evaluator as RandomSamplesEvaluator; 162 if (randomEvaluator != null) { 163 ReevaluteElites = randomEvaluator.RandomSamples != 0; 164 } 165 166 var consecutiveEvaluator = evaluator as ConsecutiveSamplesEvaluator; 167 if (consecutiveEvaluator != null) { 168 consecutiveEvaluator.DataMigrationIntervalParameter.ActualName = MigrationIntervalParameter.Name; 165 169 } 166 170 } … … 181 185 182 186 if (Problem != null && EvaluatorParameter.Value == null) { 183 EvaluatorParameter.Value = new SymbolicDataAnalysisIslandGAEvaluator();187 EvaluatorParameter.Value = new RandomSamplesEvaluator(); 184 188 } else if (Problem == null) 185 189 EvaluatorParameter.Value = null; -
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.GeneticAlgorithm
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm merged: 10037
- Property svn:mergeinfo changed
-
branches/DataAnalysis.IslandAlgorithms/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm merged: 10037
- Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.