Changeset 3226 for trunk/sources/HeuristicLab.Optimization.Operators
- Timestamp:
- 03/28/10 04:11:23 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Operators/3.3
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Optimization.Operators/3.3/HeuristicLab.Optimization.Operators-3.3.csproj ¶
r3094 r3226 82 82 <ItemGroup> 83 83 <Compile Include="ProbabilisticQualityComparator.cs" /> 84 <Compile Include="ResultsCollector.cs" /> 84 85 <Compile Include="SquareRootDiscreteDoubleValueModifier.cs" /> 85 86 <Compile Include="DiscreteDoubleValueModifier.cs" /> -
TabularUnified trunk/sources/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs ¶
r3225 r3226 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Operators; 23 24 using HeuristicLab.Parameters; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 namespace HeuristicLab.Op erators {27 namespace HeuristicLab.Optimization.Operators { 27 28 /// <summary> 28 /// An operator which collects the actual values of parameters and adds them to a collection of variables.29 /// An operator which collects the actual values of parameters and adds them to a collection of results. 29 30 /// </summary> 30 [Item("ResultsCollector", "An operator which collects the actual values of parameters and adds them to a collection of variables.")]31 [Item("ResultsCollector", "An operator which collects the actual values of parameters and adds them to a collection of results.")] 31 32 [StorableClass] 32 33 public class ResultsCollector : ValuesCollector { 33 public ValueLookupParameter< VariableCollection> ResultsParameter {34 get { return (ValueLookupParameter< VariableCollection>)Parameters["Results"]; }34 public ValueLookupParameter<ResultCollection> ResultsParameter { 35 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 35 36 } 36 37 37 38 public ResultsCollector() 38 39 : base() { 39 Parameters.Add(new ValueLookupParameter< VariableCollection>("Results", "The variablecollection where the collected values should be stored."));40 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the collected values should be stored.")); 40 41 } 41 42 42 43 public override IOperation Apply() { 43 VariableCollection results = ResultsParameter.ActualValue;44 I Variable var;44 ResultCollection results = ResultsParameter.ActualValue; 45 IResult result; 45 46 foreach (IParameter param in CollectedValues) { 46 47 IItem value = param.ActualValue; 47 48 if (value != null) { 48 results.TryGetValue(param.Name, out var);49 if ( var!= null)50 var.Value = value;49 results.TryGetValue(param.Name, out result); 50 if (result != null) 51 result.Value = value; 51 52 else 52 results.Add(new Variable(param.Name, param.Description, value));53 results.Add(new Result(param.Name, param.Description, value)); 53 54 } 54 55 }
Note: See TracChangeset
for help on using the changeset viewer.