1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using System.Drawing;
|
---|
26 | using HeuristicLab.Common;
|
---|
27 | using HeuristicLab.Core;
|
---|
28 | using HeuristicLab.Data;
|
---|
29 | using HeuristicLab.Optimization;
|
---|
30 | using HeuristicLab.Parameters;
|
---|
31 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
32 | using HeuristicLab.PluginInfrastructure;
|
---|
33 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
34 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
|
---|
35 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;
|
---|
36 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Manipulators;
|
---|
37 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureManipulators;
|
---|
38 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
|
---|
39 | using HeuristicLab.Problems.ArtificialAnt.Analyzers;
|
---|
40 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers;
|
---|
41 |
|
---|
42 | namespace HeuristicLab.Problems.ArtificialAnt {
|
---|
43 | [Item("Artificial Ant Problem", "Represents the Artificial Ant problem.")]
|
---|
44 | [Creatable("Problems")]
|
---|
45 | [StorableClass]
|
---|
46 | public sealed class ArtificialAntProblem : ParameterizedNamedItem, ISingleObjectiveProblem {
|
---|
47 | public override Image ItemImage {
|
---|
48 | get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
|
---|
49 | }
|
---|
50 |
|
---|
51 | #region constant for default world (Santa Fe)
|
---|
52 | private readonly bool[,] santaFeAntTrail = new bool[,] {
|
---|
53 | {false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
54 | {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
55 | {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, false, false, false, false},
|
---|
56 | {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, true, false, false},
|
---|
57 | {false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, true, false, false},
|
---|
58 | {false, false, false, true, true, true, true, false, true, true, true, true, true, false, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false},
|
---|
59 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false},
|
---|
60 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},
|
---|
61 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},
|
---|
62 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, true, false, false},
|
---|
63 | {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},
|
---|
64 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
65 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false},
|
---|
66 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false},
|
---|
67 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, true, true, true, false, false, false},
|
---|
68 | {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, false},
|
---|
69 | {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
70 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
71 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false},
|
---|
72 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false},
|
---|
73 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
74 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
75 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false},
|
---|
76 | {false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false},
|
---|
77 | {false, false, false, true, true, false, false, true, true, true, true, true, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
78 | {false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
79 | {false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
80 | {false, true, false, false, false, false, false, false, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
81 | {false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
82 | {false, false, false, false, false, false, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false},
|
---|
83 | {false, false, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },
|
---|
84 | {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }
|
---|
85 | };
|
---|
86 | #endregion
|
---|
87 |
|
---|
88 | #region Parameter Properties
|
---|
89 | public ValueParameter<BoolValue> MaximizationParameter {
|
---|
90 | get { return (ValueParameter<BoolValue>)Parameters["Maximization"]; }
|
---|
91 | }
|
---|
92 | IParameter ISingleObjectiveProblem.MaximizationParameter {
|
---|
93 | get { return MaximizationParameter; }
|
---|
94 | }
|
---|
95 | public ValueParameter<SymbolicExpressionTreeCreator> SolutionCreatorParameter {
|
---|
96 | get { return (ValueParameter<SymbolicExpressionTreeCreator>)Parameters["SolutionCreator"]; }
|
---|
97 | }
|
---|
98 | IParameter IProblem.SolutionCreatorParameter {
|
---|
99 | get { return SolutionCreatorParameter; }
|
---|
100 | }
|
---|
101 | public ValueParameter<Evaluator> EvaluatorParameter {
|
---|
102 | get { return (ValueParameter<Evaluator>)Parameters["Evaluator"]; }
|
---|
103 | }
|
---|
104 | IParameter IProblem.EvaluatorParameter {
|
---|
105 | get { return EvaluatorParameter; }
|
---|
106 | }
|
---|
107 | public ValueParameter<ISymbolicExpressionGrammar> ArtificialAntExpressionGrammarParameter {
|
---|
108 | get { return (ValueParameter<ISymbolicExpressionGrammar>)Parameters["ArtificialAntExpressionGrammar"]; }
|
---|
109 | }
|
---|
110 | public ValueParameter<IntValue> MaxExpressionLengthParameter {
|
---|
111 | get { return (ValueParameter<IntValue>)Parameters["MaxExpressionLength"]; }
|
---|
112 | }
|
---|
113 | public ValueParameter<IntValue> MaxExpressionDepthParameter {
|
---|
114 | get { return (ValueParameter<IntValue>)Parameters["MaxExpressionDepth"]; }
|
---|
115 | }
|
---|
116 | public ValueParameter<IntValue> MaxFunctionDefinitionsParameter {
|
---|
117 | get { return (ValueParameter<IntValue>)Parameters["MaxFunctionDefinitions"]; }
|
---|
118 | }
|
---|
119 | public ValueParameter<IntValue> MaxFunctionArgumentsParameter {
|
---|
120 | get { return (ValueParameter<IntValue>)Parameters["MaxFunctionArguments"]; }
|
---|
121 | }
|
---|
122 | public ValueParameter<BoolMatrix> WorldParameter {
|
---|
123 | get { return (ValueParameter<BoolMatrix>)Parameters["World"]; }
|
---|
124 | }
|
---|
125 | public ValueParameter<IntValue> MaxTimeStepsParameter {
|
---|
126 | get { return (ValueParameter<IntValue>)Parameters["MaxTimeSteps"]; }
|
---|
127 | }
|
---|
128 |
|
---|
129 | public ValueParameter<DoubleValue> BestKnownQualityParameter {
|
---|
130 | get { return (ValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
|
---|
131 | }
|
---|
132 | IParameter ISingleObjectiveProblem.BestKnownQualityParameter {
|
---|
133 | get { return BestKnownQualityParameter; }
|
---|
134 | }
|
---|
135 | #endregion
|
---|
136 |
|
---|
137 | #region Properties
|
---|
138 | public BoolMatrix World {
|
---|
139 | get { return WorldParameter.Value; }
|
---|
140 | set { WorldParameter.Value = value; }
|
---|
141 | }
|
---|
142 | public IntValue MaxTimeSteps {
|
---|
143 | get { return MaxTimeStepsParameter.Value; }
|
---|
144 | set { MaxTimeStepsParameter.Value = value; }
|
---|
145 | }
|
---|
146 | public IntValue MaxExpressionLength {
|
---|
147 | get { return MaxExpressionLengthParameter.Value; }
|
---|
148 | set { MaxExpressionLengthParameter.Value = value; }
|
---|
149 | }
|
---|
150 | public IntValue MaxExpressionDepth {
|
---|
151 | get { return MaxExpressionDepthParameter.Value; }
|
---|
152 | set { MaxExpressionDepthParameter.Value = value; }
|
---|
153 | }
|
---|
154 | public IntValue MaxFunctionDefinitions {
|
---|
155 | get { return MaxFunctionDefinitionsParameter.Value; }
|
---|
156 | set { MaxFunctionDefinitionsParameter.Value = value; }
|
---|
157 | }
|
---|
158 | public IntValue MaxFunctionArguments {
|
---|
159 | get { return MaxFunctionArgumentsParameter.Value; }
|
---|
160 | set { MaxFunctionArgumentsParameter.Value = value; }
|
---|
161 | }
|
---|
162 | public SymbolicExpressionTreeCreator SolutionCreator {
|
---|
163 | get { return SolutionCreatorParameter.Value; }
|
---|
164 | set { SolutionCreatorParameter.Value = value; }
|
---|
165 | }
|
---|
166 | ISolutionCreator IProblem.SolutionCreator {
|
---|
167 | get { return SolutionCreatorParameter.Value; }
|
---|
168 | }
|
---|
169 | public Evaluator Evaluator {
|
---|
170 | get { return EvaluatorParameter.Value; }
|
---|
171 | set { EvaluatorParameter.Value = value; }
|
---|
172 | }
|
---|
173 | ISingleObjectiveEvaluator ISingleObjectiveProblem.Evaluator {
|
---|
174 | get { return EvaluatorParameter.Value; }
|
---|
175 | }
|
---|
176 | IEvaluator IProblem.Evaluator {
|
---|
177 | get { return EvaluatorParameter.Value; }
|
---|
178 | }
|
---|
179 | public GlobalSymbolicExpressionGrammar ArtificialAntExpressionGrammar {
|
---|
180 | get { return (GlobalSymbolicExpressionGrammar)ArtificialAntExpressionGrammarParameter.Value; }
|
---|
181 | }
|
---|
182 | public DoubleValue BestKnownQuality {
|
---|
183 | get { return BestKnownQualityParameter.Value; }
|
---|
184 | }
|
---|
185 | private List<IOperator> operators;
|
---|
186 | public IEnumerable<IOperator> Operators {
|
---|
187 | get { return operators; }
|
---|
188 | }
|
---|
189 |
|
---|
190 | public IEnumerable<IAntTrailAnalyzer> AntTrailAnalyzers {
|
---|
191 | get { return operators.OfType<IAntTrailAnalyzer>(); }
|
---|
192 | }
|
---|
193 | #endregion
|
---|
194 |
|
---|
195 | public ArtificialAntProblem()
|
---|
196 | : base() {
|
---|
197 | SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator();
|
---|
198 | Evaluator evaluator = new Evaluator();
|
---|
199 | BoolMatrix world = new BoolMatrix(santaFeAntTrail);
|
---|
200 | ISymbolicExpressionGrammar grammar = new GlobalSymbolicExpressionGrammar(new ArtificialAntExpressionGrammar());
|
---|
201 | Parameters.Add(new ValueParameter<BoolValue>("Maximization", "Set to true as the Artificial Ant Problem is a maximization problem.", new BoolValue(true)));
|
---|
202 | Parameters.Add(new ValueParameter<SymbolicExpressionTreeCreator>("SolutionCreator", "The operator which should be used to create new artificial ant solutions.", creator));
|
---|
203 | Parameters.Add(new ValueParameter<Evaluator>("Evaluator", "The operator which should be used to evaluate artificial ant solutions.", evaluator));
|
---|
204 | Parameters.Add(new ValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this artificial ant instance.", new DoubleValue(89)));
|
---|
205 | Parameters.Add(new ValueParameter<IntValue>("MaxExpressionLength", "Maximal length of the expression to control the artificial ant.", new IntValue(100)));
|
---|
206 | Parameters.Add(new ValueParameter<IntValue>("MaxExpressionDepth", "Maximal depth of the expression to control the artificial ant.", new IntValue(10)));
|
---|
207 | Parameters.Add(new ValueParameter<IntValue>("MaxFunctionDefinitions", "Maximal number of automatically defined functions in the expression to control the artificial ant.", new IntValue(3)));
|
---|
208 | Parameters.Add(new ValueParameter<IntValue>("MaxFunctionArguments", "Maximal number of arguments of automatically defined functions in the expression to control the artificial ant.", new IntValue(3)));
|
---|
209 | Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("ArtificialAntExpressionGrammar", "The grammar that should be used for artificial ant expressions.", grammar));
|
---|
210 | Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world));
|
---|
211 | Parameters.Add(new ValueParameter<IntValue>("MaxTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));
|
---|
212 |
|
---|
213 | creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution";
|
---|
214 | evaluator.QualityParameter.ActualName = "FoodEaten";
|
---|
215 | ParameterizeSolutionCreator();
|
---|
216 | ParameterizeEvaluator();
|
---|
217 | Initialize();
|
---|
218 | }
|
---|
219 |
|
---|
220 | [StorableConstructor]
|
---|
221 | private ArtificialAntProblem(bool deserializing) : base() { }
|
---|
222 |
|
---|
223 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
224 | ArtificialAntProblem clone = (ArtificialAntProblem)base.Clone(cloner);
|
---|
225 | clone.Initialize();
|
---|
226 | return clone;
|
---|
227 | }
|
---|
228 |
|
---|
229 | #region Events
|
---|
230 | public event EventHandler SolutionCreatorChanged;
|
---|
231 | private void OnSolutionCreatorChanged() {
|
---|
232 | EventHandler handler = SolutionCreatorChanged;
|
---|
233 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
234 | }
|
---|
235 | public event EventHandler EvaluatorChanged;
|
---|
236 | private void OnEvaluatorChanged() {
|
---|
237 | EventHandler handler = EvaluatorChanged;
|
---|
238 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
239 | }
|
---|
240 | public event EventHandler OperatorsChanged;
|
---|
241 | private void OnOperatorsChanged() {
|
---|
242 | EventHandler handler = OperatorsChanged;
|
---|
243 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
244 | }
|
---|
245 | public event EventHandler Reset;
|
---|
246 | private void OnReset() {
|
---|
247 | EventHandler handler = Reset;
|
---|
248 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
249 | }
|
---|
250 |
|
---|
251 | private void SolutionCreatorParameter_ValueChanged(object sender, EventArgs e) {
|
---|
252 | SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
|
---|
253 | ParameterizeSolutionCreator();
|
---|
254 | ParameterizeEvaluator();
|
---|
255 | ParameterizeAnalyzers();
|
---|
256 | ParameterizeOperators();
|
---|
257 | OnSolutionCreatorChanged();
|
---|
258 | }
|
---|
259 | private void SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged(object sender, EventArgs e) {
|
---|
260 | ParameterizeEvaluator();
|
---|
261 | ParameterizeAnalyzers();
|
---|
262 | ParameterizeOperators();
|
---|
263 | }
|
---|
264 | private void EvaluatorParameter_ValueChanged(object sender, EventArgs e) {
|
---|
265 | Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
|
---|
266 | ParameterizeEvaluator();
|
---|
267 | ParameterizeAnalyzers();
|
---|
268 | OnEvaluatorChanged();
|
---|
269 | }
|
---|
270 |
|
---|
271 | private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
|
---|
272 | ParameterizeAnalyzers();
|
---|
273 | }
|
---|
274 |
|
---|
275 | #endregion
|
---|
276 |
|
---|
277 | #region Helpers
|
---|
278 | [StorableHook(HookType.AfterDeserialization)]
|
---|
279 | private void Initialize() {
|
---|
280 | InitializeOperators();
|
---|
281 | SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
|
---|
282 | SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
|
---|
283 | EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged);
|
---|
284 | Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
|
---|
285 | MaxFunctionArgumentsParameter.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged);
|
---|
286 | MaxFunctionArguments.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged);
|
---|
287 | MaxFunctionDefinitionsParameter.ValueChanged += new EventHandler(MaxFunctionDefinitionsParameter_ValueChanged);
|
---|
288 | MaxFunctionDefinitions.ValueChanged += new EventHandler(MaxFunctionDefinitionsParameter_ValueChanged);
|
---|
289 | }
|
---|
290 |
|
---|
291 | void MaxFunctionDefinitionsParameter_ValueChanged(object sender, EventArgs e) {
|
---|
292 | ArtificialAntExpressionGrammar.MaxFunctionDefinitions = MaxFunctionDefinitions.Value;
|
---|
293 | }
|
---|
294 |
|
---|
295 | void MaxFunctionArgumentsParameter_ValueChanged(object sender, EventArgs e) {
|
---|
296 | ArtificialAntExpressionGrammar.MaxFunctionArguments = MaxFunctionArguments.Value;
|
---|
297 | }
|
---|
298 |
|
---|
299 | private void InitializeOperators() {
|
---|
300 | operators = new List<IOperator>();
|
---|
301 | operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
|
---|
302 | operators.Add(new BestAntTrailAnalyzer());
|
---|
303 | operators.Add(new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer());
|
---|
304 | ParameterizeAnalyzers();
|
---|
305 | ParameterizeOperators();
|
---|
306 | }
|
---|
307 |
|
---|
308 | private void ParameterizeSolutionCreator() {
|
---|
309 | SolutionCreator.SymbolicExpressionGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;
|
---|
310 | SolutionCreator.MaxTreeHeightParameter.ActualName = MaxExpressionDepthParameter.Name;
|
---|
311 | SolutionCreator.MaxTreeSizeParameter.ActualName = MaxExpressionLengthParameter.Name;
|
---|
312 | }
|
---|
313 | private void ParameterizeEvaluator() {
|
---|
314 | Evaluator.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
315 | Evaluator.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
|
---|
316 | Evaluator.WorldParameter.ActualName = WorldParameter.Name;
|
---|
317 | }
|
---|
318 | private void ParameterizeAnalyzers() {
|
---|
319 | foreach (IAntTrailAnalyzer analyzer in AntTrailAnalyzers) {
|
---|
320 | analyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
|
---|
321 | analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
322 | analyzer.WorldParameter.ActualName = WorldParameter.Name;
|
---|
323 | analyzer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
|
---|
324 | }
|
---|
325 | foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
|
---|
326 | analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
327 | }
|
---|
328 | }
|
---|
329 |
|
---|
330 | private void ParameterizeOperators() {
|
---|
331 | foreach (ISymbolicExpressionTreeOperator op in Operators.OfType<ISymbolicExpressionTreeOperator>()) {
|
---|
332 | op.MaxTreeHeightParameter.ActualName = MaxExpressionDepthParameter.Name;
|
---|
333 | op.MaxTreeSizeParameter.ActualName = MaxExpressionLengthParameter.Name;
|
---|
334 | op.SymbolicExpressionGrammarParameter.ActualName = ArtificialAntExpressionGrammarParameter.Name;
|
---|
335 | }
|
---|
336 | foreach (Evaluator op in Operators.OfType<Evaluator>()) {
|
---|
337 | op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
338 | op.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;
|
---|
339 | op.WorldParameter.ActualName = WorldParameter.Name;
|
---|
340 | }
|
---|
341 | foreach (ISymbolicExpressionTreeCrossover op in Operators.OfType<ISymbolicExpressionTreeCrossover>()) {
|
---|
342 | op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
343 | op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
344 | }
|
---|
345 | foreach (ISymbolicExpressionTreeManipulator op in Operators.OfType<ISymbolicExpressionTreeManipulator>()) {
|
---|
346 | op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
|
---|
347 | }
|
---|
348 | foreach (ISymbolicExpressionTreeArchitectureManipulator op in Operators.OfType<ISymbolicExpressionTreeArchitectureManipulator>()) {
|
---|
349 | op.MaxFunctionDefinitionsParameter.ActualName = MaxFunctionDefinitionsParameter.Name;
|
---|
350 | op.MaxFunctionArgumentsParameter.ActualName = MaxFunctionArgumentsParameter.Name;
|
---|
351 | }
|
---|
352 | foreach (SymbolicExpressionTreeCreator op in Operators.OfType<SymbolicExpressionTreeCreator>()) {
|
---|
353 | op.MaxFunctionArgumentsParameter.ActualName = MaxFunctionArgumentsParameter.Name;
|
---|
354 | op.MaxFunctionDefinitionsParameter.ActualName = MaxFunctionDefinitionsParameter.Name;
|
---|
355 | }
|
---|
356 | }
|
---|
357 |
|
---|
358 |
|
---|
359 | #endregion
|
---|
360 | }
|
---|
361 | }
|
---|