Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1552


Ignore:
Timestamp:
04/14/09 11:49:33 (16 years ago)
Author:
dtraxing
Message:

added comments, removed unused source code and added a description for the operators CreateChildren and CreateChildrenHardWired(ticket #580)

Location:
trunk/sources/HeuristicLab.SGA.Hardwired/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateChildren.cs

    r1550 r1552  
    4444   
    4545    public override string Description {
    46       get { return @"Implements the functionality of method SGAMain hard wired."; }
     46      get { return @"Implements the control structures of CreateChildren hard wired. Operators are delegated."; }
    4747    }
    4848
     
    7070
    7171    public override IOperation Apply(IScope scope) {
    72 
    73       ci = new ChildrenInitializer();
    7472      crossover = (OperatorBase)GetVariableValue("Crossover", scope, true);
    7573      mutator = (OperatorBase)GetVariableValue("Mutator", scope, true);
     
    9189        counter.Execute(s);
    9290      } // foreach
    93       // set evaluated solutions
    94       //IntData value = GetVariableValue<IntData>("EvaluatedSolutions", scope, true);
    95       //value.Data = counter;
    9691
    97       // sort with using of operator
    9892      sorter.Execute(scope);
    99 
    100       // sort scopes
    101       //bool descending = false;//GetVariableValue<BoolData>("Descending", scope, true).Data;
    102       //double[] keys = new double[scope.SubScopes.Count];
    103       //int[] sequence = new int[keys.Length];
    104 
    105       //for (int i = 0; i < keys.Length; i++) {
    106       //  keys[i] = scope.SubScopes[i].GetVariableValue<DoubleData>("Quality", false).Data;
    107       //  sequence[i] = i;
    108       //}
    109 
    110       //Array.Sort<double, int>(keys, sequence);
    111 
    112       //if (descending) {
    113       //  int temp;
    114       //  for (int i = 0; i < sequence.Length / 2; i++) {
    115       //    temp = sequence[i];
    116       //    sequence[i] = sequence[sequence.Length - 1 - i];
    117       //    sequence[sequence.Length - 1 - i] = temp;
    118       //  }
    119       //}
    120       //scope.ReorderSubScopes(sequence);
    12193
    12294      return null;
    12395    } // Apply
    124 
    125   } // class SGAMain
    126 
    127 } // namespace HeuristicLab.SGA
     96  } // class CreateChildren
     97} // namespace HeuristicLab.SGA.Hardwired
  • trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateChildrenHardWired.cs

    r1551 r1552  
    7575      // UniformSequentialSubScopesProcessor
    7676      foreach (IScope s in scope.SubScopes) {
    77         crossover.Execute(s);
     77        if (crossover.Execute(s) != null)
     78          throw new InvalidOperationException("ERROR: no support for combined operators!");
     79
    7880        // Stochastic Branch
    79         if (random.NextDouble() < probability.Data)
    80           mutator.Execute(s);
    81         evaluator.Execute(s);
     81        if (random.NextDouble() < probability.Data) {
     82          if (mutator.Execute(s) != null)
     83            throw new InvalidOperationException("ERROR: no support for combined operators!");
     84        }
     85
     86        if (evaluator.Execute(s) != null)
     87          throw new InvalidOperationException("ERROR: no support for combined operators!");
     88
    8289        // subscopes remover
    8390        IntData index = GetVariableValue<IntData>("SubScopeIndex", s, true, false);
     
    120127      return null;
    121128    } // Apply
    122 
    123   } // class SGAMain
    124 
    125 } // namespace HeuristicLab.SGA
     129  } // class CreateChildrenHardWired
     130} // namespace HeuristicLab.SGA.Hardwired
Note: See TracChangeset for help on using the changeset viewer.