Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3569 for trunk


Ignore:
Timestamp:
04/30/10 10:30:24 (14 years ago)
Author:
gkronber
Message:

Changed multi-operators in symbolic expression tree encoding to populate the list of available operators via the ApplicationManager. #937 (Data types and operators for symbolic expression tree encoding)

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r3539 r3569  
    3030using HeuristicLab.Data;
    3131using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
     32using HeuristicLab.PluginInfrastructure;
    3233
    3334namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators {
     
    8889      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionGrammarParameterName, "The grammar that defines the allowed symbols and syntax of the symbolic expression trees."));
    8990
    90       Operators.Add(new ArgumentCreater());
    91       Operators.Add(new ArgumentDeleter());
    92       Operators.Add(new ArgumentDuplicater());
    93       Operators.Add(new SubroutineCreater());
    94       Operators.Add(new SubroutineDeleter());
    95       Operators.Add(new SubroutineDuplicater());
     91      foreach (var availableOperatorType in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeArchitectureManipulator))) {
     92        if (availableOperatorType != this.GetType())
     93          Operators.Add((ISymbolicExpressionTreeArchitectureManipulator)Activator.CreateInstance(availableOperatorType), true);
     94      }
    9695    }
    9796
     
    121120    }
    122121
    123     public override IOperation Apply() {
    124       if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one symbolic expression tree architecture manipulator to choose from.");
    125       return base.Apply();
    126     }
    127 
    128122    #region ISymbolicExpressionTreeArchitectureManipulator Members
    129123    public void ModifyArchitecture(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, IntValue maxFunctionDefiningBranches, IntValue maxFunctionArguments, out bool success) {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/MultiSymbolicExpressionTreeManipulator.cs

    r3534 r3569  
    3030using HeuristicLab.Data;
    3131using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
     32using HeuristicLab.PluginInfrastructure;
    3233
    3334namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators {
     
    7576      Parameters.Add(new LookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionGrammarParameterName, "The grammar that defines the allowed symbols and syntax of the symbolic expression trees."));
    7677
    77       Operators.Add(new FullTreeShaker());
    78       Operators.Add(new OnePointShaker());
    79       Operators.Add(new ChangeNodeTypeManipulation());
     78      foreach (var availableOperatorType in ApplicationManager.Manager.GetTypes(typeof(ISymbolicExpressionTreeArchitectureManipulator))) {
     79        if (availableOperatorType != this.GetType())
     80          Operators.Add((ISymbolicExpressionTreeArchitectureManipulator)Activator.CreateInstance(availableOperatorType), true);
     81      }
    8082    }
    8183
     
    102104      }
    103105    }
    104 
    105     public override IOperation Apply() {
    106       if (Operators.Count == 0) throw new InvalidOperationException(Name + ": Please add at least one symbolic expression tree manipulator to choose from.");
    107       return base.Apply();
    108     }
    109106  }
    110107}
Note: See TracChangeset for help on using the changeset viewer.