Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.SGA.Hardwired/3.3/CreateReplacementHardWired.cs @ 1558

Last change on this file since 1558 was 1558, checked in by dtraxing, 15 years ago

hardwired implementation of CreateReplacement. (ticket #580)

File size: 3.6 KB
Line 
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
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Linq;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Permutation;
29using HeuristicLab.Evolutionary;
30using HeuristicLab.Operators;
31using HeuristicLab.Routing.TSP;
32
33namespace HeuristicLab.SGA.Hardwired {
34  class CreateReplacementHardWired : OperatorBase {
35    ChildrenInitializer ci;
36    OperatorBase crossover;
37    OperatorBase mutator;
38    OperatorBase evaluator;
39    IRandom random;
40    DoubleData probability;
41
42    public override string Description {
43      get { return @"Implements the functionality CreateReplacement hard wired."; }
44    }
45
46    public CreateReplacementHardWired()
47      : base() {
48      ci = new ChildrenInitializer();
49
50      // variables infos
51      AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In));
52      AddVariableInfo(new VariableInfo("MutationRate", "Probability to choose first branch", typeof(DoubleData), VariableKind.In));
53      AddVariableInfo(new VariableInfo("Crossover", "Crossover strategy for SGA", typeof(OperatorBase), VariableKind.In));
54      AddVariableInfo(new VariableInfo("Mutator", "Mutation strategy for SGA", typeof(OperatorBase), VariableKind.In));
55      AddVariableInfo(new VariableInfo("Evaluator", "Evaluation strategy for SGA", typeof(OperatorBase), VariableKind.In));
56      AddVariableInfo(new VariableInfo("SubScopeIndex", "(Optional) the index of the subscope to remove", typeof(IntData), VariableKind.In));
57      AddVariableInfo(new VariableInfo("EvaluatedSolutions", "Number of evaluated solutions", typeof(IntData), VariableKind.In | VariableKind.Out));
58      AddVariableInfo(new VariableInfo("Maximization", "Sort in descending order", typeof(BoolData), VariableKind.In));
59      AddVariableInfo(new VariableInfo("Quality", "Sorting value", typeof(DoubleData), VariableKind.In));
60      GetVariableInfo("SubScopeIndex").Local = true;
61    }
62
63    public override IOperation Apply(IScope scope) {
64 
65      // SequentialSubScopesProcessor
66      foreach (IScope s in scope.SubScopes) {
67        //sp2
68        //LeftSelector ls = new LeftSelector();
69        //ls.GetVariableInfo("Selected").ActualName = "Elites";
70        //RightReducer rr = new RightReducer();
71
72        //sp3
73        //RightSelector rs = new RightSelector();
74        //rs.GetVariableInfo("Selected").ActualName = "Elites";
75        //LeftReducer lr = new LeftReducer();
76
77        //MergingReducer mr = new MergingReducer();
78
79        //Sorter s = new Sorter();
80        //s.GetVariableInfo("Descending").ActualName = "Maximization";
81        //s.GetVariableInfo("Value").ActualName = "Quality";
82      } // foreach
83
84      return null;
85    } // Apply
86  } // class CreateReplacementHardWired
87} // namespace HeuristicLab.SGA.Hardwired
Note: See TracBrowser for help on using the repository browser.