Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/09 10:47:00 (15 years ago)
Author:
gkronber
Message:

GP Refactoring: #713

  • added project GP.Operators
  • moved operators from plugin GP to plugin GP.Operators
  • deleted unused constraints
  • removed dependency of GP plugins on Constraints plugin
  • moved StructID functions into directory Symbols
  • deleted unused class FunView
  • implemented add and remove functionality for the FunctionLibraryView
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/FunctionLibrary.cs

    r2210 r2212  
    2626using HeuristicLab.Core;
    2727using System.Xml;
    28 using HeuristicLab.Data;
    29 using HeuristicLab.Constraints;
    3028using HeuristicLab.GP.Interfaces;
    3129
     
    4139    }
    4240
    43 
    4441    public void AddFunction(IFunction fun) {
    45       if (!functions.Contains(fun)) functions.Add(fun);
    46       // OnFunctionAdded(fun);
     42      if (!functions.Contains(fun)) {
     43        functions.Add(fun);
     44        OnChanged();
     45      }
    4746    }
    48 
    49     //void UpdateTreeBounds(object sender, EventArgs e) {
    50     //  RecalculateMinimalTreeBounds();
    51     //}
    52 
    53 
    54     //private void GetMinMaxArity(IOperator op, out int minArity, out int maxArity) {
    55     //  foreach (IConstraint constraint in op.Constraints) {
    56     //    NumberOfSubOperatorsConstraint theConstraint = constraint as NumberOfSubOperatorsConstraint;
    57     //    if (theConstraint != null) {
    58     //      minArity = theConstraint.MinOperators.Data;
    59     //      maxArity = theConstraint.MaxOperators.Data;
    60     //      return;
    61     //    }
    62     //  }
    63     //  // the default arity is 2
    64     //  minArity = 2;
    65     //  maxArity = 2;
    66     //}
    6747
    6848    public void RemoveFunction(IFunction fun) {
    6949      functions.Remove(fun);
    7050
    71       // remove the operator from the allowed sub-functions of the remaining operators
     51      // remove the operator from the allowed sub-functions of all functions
    7252      foreach (IFunction f in Functions) {
    73         if (f != fun) {
     53        for (int i = 0; i < f.MaxSubTrees; i++) {
     54          f.RemoveAllowedSubFunction(fun, i);
    7455        }
    7556      }
    76       // OnFunctionRemoved(fun);
     57      OnChanged();
    7758    }
    78 
    79     //public event EventHandler FunctionAdded;
    80     //public event EventHandler FunctionRemoved;
    81 
    82     //protected virtual void OnFunctionAdded(IFunction fun) {
    83     //  if (FunctionAdded != null) {
    84     //    FunctionAdded(this, new EventArgs(fun));
    85     //  }
    86     //}
    87     //protected virtual void OnFunctionRemoved(IFunction fun) {
    88     //  if (FunctionRemoved != null) {
    89     //    FunctionRemoved(this, new EventArgs(fun));
    90     //  }
    91     //}
    9259
    9360    public override IView CreateView() {
Note: See TracChangeset for help on using the changeset viewer.