Free cookie consent management tool by TermsFeed Policy Generator

Changeset 429


Ignore:
Timestamp:
08/03/08 23:00:48 (16 years ago)
Author:
gkronber
Message:

fixed compilation problems introduced with r428 (ticket #225)

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/FunctionBase.cs

    r425 r429  
    3434  /// </summary>
    3535  public abstract class FunctionBase : OperatorBase, IFunction {
    36     protected const string INITIALIZATION = "Initialization";
    37     protected const string MANIPULATION = "Manipulation";
     36    public const string INITIALIZATION = "Initialization";
     37    public const string MANIPULATION = "Manipulation";
    3838
    3939
  • trunk/sources/HeuristicLab.StructureIdentification/GPOperatorGroup.cs

    r425 r429  
    4040
    4141      var localVariableInfos = op.VariableInfos.Where(f => f.Local);
    42 
    43       //if(op.GetVariable(GPOperatorLibrary.MANIPULATION) == null) {
    44       //  CombinedOperator manipulationOperator = new CombinedOperator();
    45       //  SequentialProcessor manipulationSequence = new SequentialProcessor();
    46       //  foreach(IVariableInfo variableInfo in localVariableInfos) {
    47       //    IOperator manipulator = GetDefaultManipulationOperator(variableInfo);
    48       //    if (manipulator != null) {
    49       //      manipulationSequence.AddSubOperator(manipulator);
    50       //    }
    51       //  }
    52       //  if(manipulationSequence.SubOperators.Count > 0) {
    53       //    op.AddVariable(new Variable(GPOperatorLibrary.MANIPULATION, manipulationOperator));
    54 
    55       //    manipulationOperator.OperatorGraph.AddOperator(manipulationSequence);
    56       //    manipulationOperator.OperatorGraph.InitialOperator = manipulationSequence;
    57       //    foreach(IOperator subOp in manipulationSequence.SubOperators) {
    58       //      manipulationOperator.OperatorGraph.AddOperator(subOp);
    59       //    }
    60       //  }
    61       //}
    62 
    63       //if(op.GetVariable(GPOperatorLibrary.INITIALIZATION) == null) {
    64       //  CombinedOperator initOperator = new CombinedOperator();
    65       //  SequentialProcessor initSequence = new SequentialProcessor();
    66       //  foreach(IVariableInfo variableInfo in localVariableInfos) {
    67       //    IOperator initializer = GetDefaultInitOperator(variableInfo);
    68       //    if (initializer != null) {
    69       //      initSequence.AddSubOperator(initializer);
    70       //    }
    71       //  }
    72       //  if(initSequence.SubOperators.Count > 0) {
    73       //    op.AddVariable(new Variable(GPOperatorLibrary.INITIALIZATION, initOperator));
    74       //    initOperator.OperatorGraph.AddOperator(initSequence);
    75       //    initOperator.OperatorGraph.InitialOperator = initSequence;
    76       //    foreach(IOperator subOp in initSequence.SubOperators) {
    77       //      initOperator.OperatorGraph.AddOperator(subOp);
    78       //    }
    79       //  }
    80       //}
    8142
    8243      // add a new typeid if necessary
     
    243204    }
    244205
    245 
    246     //private IOperator GetDefaultManipulationOperator(IVariableInfo variableInfo) {
    247     //  IOperator shaker;
    248     //  if(variableInfo.DataType == typeof(ConstrainedDoubleData) ||
    249     //    variableInfo.DataType == typeof(ConstrainedIntData) ||
    250     //    variableInfo.DataType == typeof(DoubleData) ||
    251     //    variableInfo.DataType == typeof(IntData)) {
    252     //    shaker = new NormalRandomAdder();
    253     //  } else {
    254     //    return null;
    255     //  }
    256     //  shaker.GetVariableInfo("Value").ActualName = variableInfo.FormalName;
    257     //  shaker.Name = variableInfo.FormalName + " manipulation";
    258     //  return shaker;
    259     //}
    260 
    261     //private IOperator GetDefaultInitOperator(IVariableInfo variableInfo) {
    262     //  IOperator shaker;
    263     //  if(variableInfo.DataType == typeof(ConstrainedDoubleData) ||
    264     //    variableInfo.DataType == typeof(ConstrainedIntData) ||
    265     //    variableInfo.DataType == typeof(DoubleData) ||
    266     //    variableInfo.DataType == typeof(IntData)) {
    267     //    shaker = new UniformRandomizer();
    268     //  } else {
    269     //    return null;
    270     //  }
    271     //  shaker.GetVariableInfo("Value").ActualName = variableInfo.FormalName;
    272     //  shaker.Name = variableInfo.FormalName + " initialization";
    273     //  return shaker;
    274     //}
    275 
    276206    public override void AddSubGroup(IOperatorGroup group) {
    277207      throw new NotSupportedException();
  • trunk/sources/HeuristicLab.StructureIdentification/GPOperatorLibraryEditor.cs

    r423 r429  
    3333using HeuristicLab.Operators;
    3434using HeuristicLab.Random;
     35using HeuristicLab.Functions;
    3536
    3637namespace HeuristicLab.StructureIdentification {
     
    5455
    5556      foreach(IOperator op in library.Group.Operators) {
    56         if(op.GetVariable(GPOperatorLibrary.MANIPULATION) != null) {
     57        if(op.GetVariable(FunctionBase.MANIPULATION) != null) {
    5758          ListViewItem item = new ListViewItem();
    5859          item.Text = op.Name;
     
    6162          mutationListView.Items.Add(item);
    6263        }
    63         if(op.GetVariable(GPOperatorLibrary.INITIALIZATION) != null) {
     64        if(op.GetVariable(FunctionBase.INITIALIZATION) != null) {
    6465          ListViewItem item = new ListViewItem();
    6566          item.Name = op.Name;
     
    7475    private void GPOperatorLibraryView_OperatorAdded(object sender, EventArgs e) {
    7576      IOperator op = ((OperatorEventArgs)e).op;
    76       if (op.GetVariable(GPOperatorLibrary.MANIPULATION) != null) {
     77      if(op.GetVariable(FunctionBase.MANIPULATION) != null) {
    7778        ListViewItem operatorMutationItem = new ListViewItem();
    7879        operatorMutationItem.Name = op.Name;
     
    8283      }
    8384
    84       if (op.GetVariable(GPOperatorLibrary.INITIALIZATION) != null) {
     85      if(op.GetVariable(FunctionBase.INITIALIZATION) != null) {
    8586        ListViewItem operatorInitItem = new ListViewItem();
    8687        operatorInitItem.Name = op.Name;
     
    133134    private void mutationListView_SelectedIndexChanged(object sender, EventArgs e) {
    134135      if(mutationListView.SelectedItems.Count>0 && mutationListView.SelectedItems[0].Tag != null) {
    135         IVariable variable = ((IOperator)mutationListView.SelectedItems[0].Tag).GetVariable(GPOperatorLibrary.MANIPULATION);
     136        IVariable variable = ((IOperator)mutationListView.SelectedItems[0].Tag).GetVariable(FunctionBase.MANIPULATION);
    136137        mutationVariableView.Enabled = true;
    137138        mutationVariableView.Variable = variable;
     
    143144    private void initListView_SelectedIndexChanged(object sender, EventArgs e) {
    144145      if(initListView.SelectedItems.Count>0 && initListView.SelectedItems[0].Tag != null) {
    145         IVariable variable = ((IOperator)initListView.SelectedItems[0].Tag).GetVariable(GPOperatorLibrary.INITIALIZATION);
     146        IVariable variable = ((IOperator)initListView.SelectedItems[0].Tag).GetVariable(FunctionBase.INITIALIZATION);
    146147        initVariableView.Enabled = true;
    147148        initVariableView.Variable = variable;
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/FullTreeShaker.cs

    r155 r429  
    3434  public class FullTreeShaker : DelegatingOperator {
    3535    public override string Description {
    36       get { return "Manipulates all tree nodes for which a '"+GPOperatorLibrary.MANIPULATION+"' variable is defined."; }
     36      get { return "Manipulates all tree nodes for which a '" + FunctionBase.MANIPULATION + "' variable is defined."; }
    3737    }
    3838
     
    5757
    5858      TreeGardener gardener = new TreeGardener(mt, library);
    59       var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Function.GetVariable(GPOperatorLibrary.MANIPULATION) != null);
     59      var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Function.GetVariable(FunctionBase.MANIPULATION) != null);
    6060      foreach(IFunctionTree subTree in parametricBranches) {
    61         IOperator mutation =(IOperator)subTree.Function.GetVariable(GPOperatorLibrary.MANIPULATION).Value;
     61        IOperator mutation = (IOperator)subTree.Function.GetVariable(FunctionBase.MANIPULATION).Value;
    6262
    6363        // store all local variables into a temporary scope
     
    7373      // save all existing sub-scopes in a backup scope
    7474      Scope backupScope = new Scope("backup");
    75       foreach (Scope subScope in scope.SubScopes) {
     75      foreach(Scope subScope in scope.SubScopes) {
    7676        backupScope.AddSubScope(subScope);
    7777      }
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/OnePointShaker.cs

    r155 r429  
    3434  public class OnePointShaker : DelegatingOperator {
    3535    public override string Description {
    36       get { return "Selects a random node of all tree-nodes that have a '"+GPOperatorLibrary.MANIPULATION+"' variable defined and manipulates the selected node."; }
     36      get { return "Selects a random node of all tree-nodes that have a '"+FunctionBase.MANIPULATION+"' variable defined and manipulates the selected node."; }
    3737    }
    3838
     
    5252
    5353      // get all nodes for which a manipulation is defined
    54       var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Function.GetVariable(GPOperatorLibrary.MANIPULATION) != null);
     54      var parametricBranches = gardener.GetAllSubTrees(tree).Where(branch => branch.Function.GetVariable(FunctionBase.MANIPULATION) != null);
    5555      IFunctionTree selectedBranch = parametricBranches.ElementAt(mt.Next(parametricBranches.Count()));
    56       IOperator mutation = (IOperator)selectedBranch.Function.GetVariable(GPOperatorLibrary.MANIPULATION).Value;
     56      IOperator mutation = (IOperator)selectedBranch.Function.GetVariable(FunctionBase.MANIPULATION).Value;
    5757      CompositeOperation next = new CompositeOperation();
    5858
  • trunk/sources/HeuristicLab.StructureIdentification/TreeGardener.cs

    r325 r429  
    216216      Scope tempScope = new Scope("Temp. initialization scope");
    217217
    218       var parametricTrees = trees.Where(t => t.Function.GetVariable(GPOperatorLibrary.INITIALIZATION) != null);
     218      var parametricTrees = trees.Where(t => t.Function.GetVariable(FunctionBase.INITIALIZATION) != null);
    219219      foreach(IFunctionTree tree in parametricTrees) {
    220220        // enqueue an initialization operation for each operator with local variables
    221         IOperator initialization = (IOperator)tree.Function.GetVariable(GPOperatorLibrary.INITIALIZATION).Value;
     221        IOperator initialization = (IOperator)tree.Function.GetVariable(FunctionBase.INITIALIZATION).Value;
    222222        Scope initScope = new Scope();
    223223        // copy the local variables into a temporary scope used for initialization
Note: See TracChangeset for help on using the changeset viewer.