Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7322


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
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithm.cs

    r7288 r7322  
    256256
    257257      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);
    258260      solutionsCreator.Successor = null;
    259261
  • branches/HiveHiveEngine/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/ParallelIslandGeneticAlgorithmMainLoop.cs

    r7310 r7322  
    240240      subScopesRemover.RemoveAllSubScopes = true;
    241241
    242       uniformSubScopesProcessor3.Parallel.Value = true;
    243 
    244242      evaluator.Name = "Evaluator (placeholder)";
    245243      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
     
    270268
    271269      generationsReducer.Name = "Increment Generations";
    272       generationsReducer.ParameterToReduce.Value = new StringValue(islandGenerationsCounter.ValueParameter.ActualName);
     270      generationsReducer.ParameterToReduce.ActualName = islandGenerationsCounter.ValueParameter.ActualName;
    273271      generationsReducer.TargetParameterName.Value = new StringValue("Generations");
    274272
    275273      evaluatedSolutionsReducer.Name = "Increment Evaluated Solutions";
    276       evaluatedSolutionsReducer.ParameterToReduce.Value = new StringValue(IslandEvaluatedSolutions.Name);
     274      evaluatedSolutionsReducer.ParameterToReduce.ActualName = IslandEvaluatedSolutions.Name;
    277275      evaluatedSolutionsReducer.TargetParameterName.Value = new StringValue(EvaluatedSolutionsParameter.Name);
    278276
  • 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.