Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP-Refactoring-713/sources/HeuristicLab.GP.SantaFe/3.3/FunctionLibraryInjector.cs @ 2216

Last change on this file since 2216 was 2216, checked in by gkronber, 15 years ago

GP Refactoring #713

  • cleaned code
  • reintegrated GP.Boolean and GP.SantaFe
  • worked on serialization of function trees
File size: 2.1 KB
RevLine 
[641]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
[2216]22using HeuristicLab.GP.Interfaces;
[641]23
24namespace HeuristicLab.GP.SantaFe {
[2216]25  public class FunctionLibraryInjector : FunctionLibraryInjectorBase {
[641]26
27    public override string Description {
28      get { return @"Injects a function library for the ant problem."; }
29    }
30
31    public FunctionLibraryInjector()
32      : base() {
33    }
34
[2216]35    protected override FunctionLibrary CreateFunctionLibrary() {
36      FunctionLibrary funLib = new FunctionLibrary();
[641]37      IfFoodAhead ifFoodAhead = new IfFoodAhead();
38      Prog2 prog2 = new Prog2();
39      Prog3 prog3 = new Prog3();
40      Move move = new Move();
41      Left left = new Left();
42      Right right = new Right();
43
44      IFunction[] allFunctions = new IFunction[] {
45        ifFoodAhead,
46        prog2,
47        prog3,
48        move,
49        left,
50        right
51      };
52
53      SetAllowedSubOperators(ifFoodAhead, allFunctions);
54      SetAllowedSubOperators(prog2, allFunctions);
55      SetAllowedSubOperators(prog3, allFunctions);
56
[2216]57      funLib.AddFunction(ifFoodAhead);
58      funLib.AddFunction(prog2);
59      funLib.AddFunction(prog3);
60      funLib.AddFunction(move);
61      funLib.AddFunction(left);
62      funLib.AddFunction(right);
63      return funLib;
[641]64    }
65  }
66}
Note: See TracBrowser for help on using the repository browser.