Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/12/12 19:31:53 (12 years ago)
Author:
ascheibe
Message:

#1745

  • disabled parallel solution creation and evaluation because of the hive engine
  • improved parameter lookup in reduction operators
  • added ReductionTypes
Location:
branches/HiveHiveEngine/HeuristicLab.Operators/3.3
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveHiveEngine/HeuristicLab.Operators/3.3/AllSubScopesIntReducer.cs

    r7288 r7322  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using System.Linq;
    2423using HeuristicLab.Common;
     
    3635  public sealed class AllSubScopesIntReducer : SingleSuccessorOperator {
    3736
    38     public ValueLookupParameter<StringValue> ParameterToReduce {
    39       get { return (ValueLookupParameter<StringValue>)Parameters["ParameterToReduce"]; }
     37    public ScopeTreeLookupParameter<IntValue> ParameterToReduce {
     38      get { return (ScopeTreeLookupParameter<IntValue>)Parameters["ParameterToReduce"]; }
    4039    }
    4140
     
    5554    public AllSubScopesIntReducer()
    5655      : 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"));
    5857      Parameters.Add(new ValueLookupParameter<StringValue>("TargetParameterName", "Parameter name to add the value to", new StringValue(string.Empty)));
    5958      Parameters.Add(new LookupParameter<IntValue>("TargetParameter", "The actual parameter defined by TargetParameterName"));
     
    6564
    6665    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;
    7067
    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) {
    7969        int sum = intValues.Sum(x => x.Value);
    8070
  • branches/HiveHiveEngine/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r7288 r7322  
    119119    <Compile Include="AlgorithmOperator.cs" />
    120120    <Compile Include="AllSubScopesIntReducer.cs" />
     121    <Compile Include="ReductionTypes.cs" />
    121122    <Compile Include="SubScopesIntReducer.cs" />
    122123    <Compile Include="MultiOperator.cs" />
  • branches/HiveHiveEngine/HeuristicLab.Operators/3.3/SubScopesIntReducer.cs

    r7288 r7322  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Linq;
    2524using HeuristicLab.Common;
     
    3736  public sealed class SubScopesIntReducer : SingleSuccessorOperator {
    3837
    39     public ValueLookupParameter<StringValue> ParameterToReduce {
    40       get { return (ValueLookupParameter<StringValue>)Parameters["ParameterToReduce"]; }
     38    public ScopeTreeLookupParameter<IntValue> ParameterToReduce {
     39      get { return (ScopeTreeLookupParameter<IntValue>)Parameters["ParameterToReduce"]; }
    4140    }
    4241
     
    5655    public SubScopesIntReducer()
    5756      : 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"));
    5958      Parameters.Add(new ValueLookupParameter<StringValue>("TargetParameterName", "Parameter name to add the value to", new StringValue(string.Empty)));
    6059      Parameters.Add(new LookupParameter<IntValue>("TargetParameter", "The actual parameter defined by TargetParameterName"));
     
    6665
    6766    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;
    7168
    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) {
    8070        int oneValue = intValues.First().Value;
    8171        if (!intValues.All(x => x.Value == oneValue)) {
Note: See TracChangeset for help on using the changeset viewer.