Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/21/08 11:45:52 (16 years ago)
Author:
gkronber
Message:

changed boolean variable BalanceTrees to double BalancedTreesRate (ticket #11)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/CutOutNodeManipulation.cs

    r2 r23  
    5252      AddVariableInfo(new VariableInfo("MaxTreeHeight", "The maximal allowed height of the tree", typeof(IntData), VariableKind.In));
    5353      AddVariableInfo(new VariableInfo("MaxTreeSize", "The maximal allowed size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
    54       AddVariableInfo(new VariableInfo("BalanceTrees", "Determines if the trees should be balanced", typeof(BoolData), VariableKind.In));
     54      AddVariableInfo(new VariableInfo("BalancedTreesRate", "Determines how many trees should be balanced", typeof(DoubleData), VariableKind.In));
    5555      AddVariableInfo(new VariableInfo("OperatorTree", "The tree to mutate", typeof(IOperator), VariableKind.In));
    5656      AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.In));
     
    6565      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
    6666      int maxTreeSize = GetVariableValue<IntData>("MaxTreeSize", scope, true).Data;
    67       bool balanceTrees = GetVariableValue<BoolData>("BalanceTrees", scope, true).Data;
     67      double balancedTreesRate = GetVariableValue<DoubleData>("BalancedTreesRate", scope, true).Data;
    6868
    6969      TreeGardener gardener = new TreeGardener(random, library);
     
    9595        } else {
    9696          // create a new random tree
    97           IOperator newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, balanceTrees);
     97          IOperator newOperator;
     98          if(random.NextDouble() <= balancedTreesRate) {
     99            newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, true);
     100          } else {
     101            newOperator = gardener.CreateRandomTree(gardener.AllOperators, maxTreeSize, maxTreeHeight, false);
     102          }
    98103
    99104          GetVariableValue<IntData>("TreeSize", scope, true).Data = gardener.GetTreeSize(newOperator);
Note: See TracChangeset for help on using the changeset viewer.