Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1039


Ignore:
Timestamp:
12/19/08 12:11:04 (15 years ago)
Author:
gkronber
Message:

fixed #439 (One-Point Shaker does not work for terminals without parameters)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP/Manipulation/OnePointShaker.cs

    r656 r1039  
    5252      // get all nodes for which a manipulation is defined
    5353      var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Function.GetVariable(FunctionBase.MANIPULATION) != null);
     54
     55      if(parametricBranches.Count() == 0) return null; // don't manipulate anything if there are no nodes with a manipulation operator
     56
    5457      IFunctionTree selectedBranch = parametricBranches.ElementAt(mt.Next(parametricBranches.Count()));
    5558      IOperator mutation = (IOperator)selectedBranch.Function.GetVariable(FunctionBase.MANIPULATION).Value;
Note: See TracChangeset for help on using the changeset viewer.