Changeset 7322 for branches/HiveHiveEngine
- Timestamp:
- 01/12/12 19:31:53 (13 years ago)
- Location:
- branches/HiveHiveEngine
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithm.cs
r7288 r7322 256 256 257 257 solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name; 258 //don't create solutions in parallel because the hive engine would distribute these tasks 259 solutionsCreator.ParallelParameter.Value = new BoolValue(false); 258 260 solutionsCreator.Successor = null; 259 261 -
branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithmMainLoop.cs
r7310 r7322 240 240 subScopesRemover.RemoveAllSubScopes = true; 241 241 242 uniformSubScopesProcessor3.Parallel.Value = true;243 244 242 evaluator.Name = "Evaluator (placeholder)"; 245 243 evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name; … … 270 268 271 269 generationsReducer.Name = "Increment Generations"; 272 generationsReducer.ParameterToReduce. Value = new StringValue(islandGenerationsCounter.ValueParameter.ActualName);270 generationsReducer.ParameterToReduce.ActualName = islandGenerationsCounter.ValueParameter.ActualName; 273 271 generationsReducer.TargetParameterName.Value = new StringValue("Generations"); 274 272 275 273 evaluatedSolutionsReducer.Name = "Increment Evaluated Solutions"; 276 evaluatedSolutionsReducer.ParameterToReduce. Value = new StringValue(IslandEvaluatedSolutions.Name);274 evaluatedSolutionsReducer.ParameterToReduce.ActualName = IslandEvaluatedSolutions.Name; 277 275 evaluatedSolutionsReducer.TargetParameterName.Value = new StringValue(EvaluatedSolutionsParameter.Name); 278 276 -
branches/HiveHiveEngine/HeuristicLab.Operators/3.3/AllSubScopesIntReducer.cs
r7288 r7322 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using System.Linq; 24 23 using HeuristicLab.Common; … … 36 35 public sealed class AllSubScopesIntReducer : SingleSuccessorOperator { 37 36 38 public ValueLookupParameter<StringValue> ParameterToReduce {39 get { return ( ValueLookupParameter<StringValue>)Parameters["ParameterToReduce"]; }37 public ScopeTreeLookupParameter<IntValue> ParameterToReduce { 38 get { return (ScopeTreeLookupParameter<IntValue>)Parameters["ParameterToReduce"]; } 40 39 } 41 40 … … 55 54 public AllSubScopesIntReducer() 56 55 : base() { 57 Parameters.Add(new ValueLookupParameter<StringValue>("ParameterToReduce", "Parameter to look for in the sub scopes and collect the values from", new StringValue(string.Empty)));56 Parameters.Add(new ScopeTreeLookupParameter<IntValue>("ParameterToReduce", "The actual parameter defined by TargetParameterName")); 58 57 Parameters.Add(new ValueLookupParameter<StringValue>("TargetParameterName", "Parameter name to add the value to", new StringValue(string.Empty))); 59 58 Parameters.Add(new LookupParameter<IntValue>("TargetParameter", "The actual parameter defined by TargetParameterName")); … … 65 64 66 65 public override IOperation Apply() { 67 //at the moment we are always operating on level 0 68 ScopeList sl = ExecutionContext.Scope.SubScopes; 69 List<IntValue> intValues = new List<IntValue>(); 66 var intValues = ParameterToReduce.ActualValue; 70 67 71 foreach (var scope in sl) { 72 var variable = scope.Variables.Where(x => x.Name == ParameterToReduce.Value.ToString()); 73 if (variable.Count() == 1) { 74 intValues.Add((IntValue)variable.First().Value); 75 } 76 } 77 78 if (intValues.Count > 0) { 68 if (intValues.Count() > 0) { 79 69 int sum = intValues.Sum(x => x.Value); 80 70 -
branches/HiveHiveEngine/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r7288 r7322 119 119 <Compile Include="AlgorithmOperator.cs" /> 120 120 <Compile Include="AllSubScopesIntReducer.cs" /> 121 <Compile Include="ReductionTypes.cs" /> 121 122 <Compile Include="SubScopesIntReducer.cs" /> 122 123 <Compile Include="MultiOperator.cs" /> -
branches/HiveHiveEngine/HeuristicLab.Operators/3.3/SubScopesIntReducer.cs
r7288 r7322 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Common; … … 37 36 public sealed class SubScopesIntReducer : SingleSuccessorOperator { 38 37 39 public ValueLookupParameter<StringValue> ParameterToReduce {40 get { return ( ValueLookupParameter<StringValue>)Parameters["ParameterToReduce"]; }38 public ScopeTreeLookupParameter<IntValue> ParameterToReduce { 39 get { return (ScopeTreeLookupParameter<IntValue>)Parameters["ParameterToReduce"]; } 41 40 } 42 41 … … 56 55 public SubScopesIntReducer() 57 56 : base() { 58 Parameters.Add(new ValueLookupParameter<StringValue>("ParameterToReduce", "Parameter to look for in the sub scopes and collect the values from", new StringValue(string.Empty)));57 Parameters.Add(new ScopeTreeLookupParameter<IntValue>("ParameterToReduce", "The actual parameter defined by TargetParameterName")); 59 58 Parameters.Add(new ValueLookupParameter<StringValue>("TargetParameterName", "Parameter name to add the value to", new StringValue(string.Empty))); 60 59 Parameters.Add(new LookupParameter<IntValue>("TargetParameter", "The actual parameter defined by TargetParameterName")); … … 66 65 67 66 public override IOperation Apply() { 68 //at the moment we are always operating on level 0 69 ScopeList sl = ExecutionContext.Scope.SubScopes; 70 List<IntValue> intValues = new List<IntValue>(); 67 var intValues = ParameterToReduce.ActualValue; 71 68 72 foreach (var scope in sl) { 73 var variable = scope.Variables.Where(x => x.Name == ParameterToReduce.Value.ToString()); 74 if (variable.Count() == 1) { 75 intValues.Add((IntValue)variable.First().Value); 76 } 77 } 78 79 if (intValues.Count > 0) { 69 if (intValues.Count() > 0) { 80 70 int oneValue = intValues.First().Value; 81 71 if (!intValues.All(x => x.Value == oneValue)) {
Note: See TracChangeset
for help on using the changeset viewer.