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