Changeset 3616 for trunk/sources/HeuristicLab.Problems.ArtificialAnt
- Timestamp:
- 05/05/10 00:48:18 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs
r3539 r3616 125 125 } 126 126 127 public OptionalValueParameter<ISingleObjectiveSolutionsVisualizer> VisualizerParameter {128 get { return (OptionalValueParameter<ISingleObjectiveSolutionsVisualizer>)Parameters["Visualizer"]; }129 }130 IParameter IProblem.VisualizerParameter {131 get { return VisualizerParameter; }132 }133 127 public ValueParameter<DoubleValue> BestKnownQualityParameter { 134 128 get { return (ValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 184 178 get { return (GlobalSymbolicExpressionGrammar)ArtificialAntExpressionGrammarParameter.Value; } 185 179 } 186 public ISingleObjectiveSolutionsVisualizer Visualizer {187 get { return VisualizerParameter.Value; }188 set { VisualizerParameter.Value = value; }189 }190 ISolutionsVisualizer IProblem.Visualizer {191 get { return VisualizerParameter.Value; }192 }193 180 public DoubleValue BestKnownQuality { 194 181 get { return BestKnownQualityParameter.Value; } … … 204 191 SymbolicExpressionTreeCreator creator = new ProbabilisticTreeCreator(); 205 192 Evaluator evaluator = new Evaluator(); 206 BestAntTrailVisualizer visualizer = new BestAntTrailVisualizer();207 193 BoolMatrix world = new BoolMatrix(santaFeAntTrail); 208 194 ISymbolicExpressionGrammar grammar = new GlobalSymbolicExpressionGrammar(new ArtificialAntExpressionGrammar()); … … 218 204 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world)); 219 205 Parameters.Add(new ValueParameter<IntValue>("MaxTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600))); 220 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionsVisualizer>("Visualizer", "The operator which should be used to visualize artificial ant solutions.", visualizer));221 206 222 207 creator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolution"; … … 251 236 changed(this, EventArgs.Empty); 252 237 } 253 public event EventHandler VisualizerChanged;254 private void OnVisualizerChanged() {255 var changed = VisualizerChanged;256 if (changed != null)257 changed(this, EventArgs.Empty);258 }259 238 260 239 public event EventHandler OperatorsChanged; … … 283 262 ParameterizeVisualizer(); 284 263 OnEvaluatorChanged(); 285 }286 287 private void VisualizerParameter_ValueChanged(object sender, EventArgs e) {288 ParameterizeVisualizer();289 OnVisualizerChanged();290 264 } 291 265 … … 304 278 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 305 279 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 306 VisualizerParameter.ValueChanged += new EventHandler(VisualizerParameter_ValueChanged);307 280 MaxFunctionArgumentsParameter.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged); 308 281 MaxFunctionArguments.ValueChanged += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged); … … 336 309 } 337 310 private void ParameterizeVisualizer() { 338 if (Visualizer != null) {339 Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;340 var antTrailVisualizer = Visualizer as IAntTrailVisualizer;341 if (antTrailVisualizer != null) {342 antTrailVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;343 antTrailVisualizer.WorldParameter.ActualName = WorldParameter.Name;344 antTrailVisualizer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name;345 }346 var bestSymExpressionVisualizer = Visualizer as BestSymbolicExpressionTreeVisualizer;347 if (bestSymExpressionVisualizer != null) {348 bestSymExpressionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;349 }350 }311 //if (Visualizer != null) { 312 // Visualizer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 313 // var antTrailVisualizer = Visualizer as IAntTrailVisualizer; 314 // if (antTrailVisualizer != null) { 315 // antTrailVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 316 // antTrailVisualizer.WorldParameter.ActualName = WorldParameter.Name; 317 // antTrailVisualizer.MaxTimeStepsParameter.ActualName = MaxTimeStepsParameter.Name; 318 // } 319 // var bestSymExpressionVisualizer = Visualizer as BestSymbolicExpressionTreeVisualizer; 320 // if (bestSymExpressionVisualizer != null) { 321 // bestSymExpressionVisualizer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 322 // } 323 //} 351 324 } 352 325 -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/BestAntTrailVisualizer.cs
r3376 r3616 53 53 get { return (ILookupParameter<AntTrail>)Parameters["AntTrail"]; } 54 54 } 55 ILookupParameter ISolutionsVisualizer.VisualizationParameter {56 get { return AntTrailParameter; }57 }58 55 59 56 public BestAntTrailVisualizer() -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/BestSymbolicExpressionTreeVisualizer.cs
r3376 r3616 36 36 [Item("BestSymbolicExpressionTreeVisualizer", "An operator for visualizing the best symbolic expression tree of an artificial ant problem.")] 37 37 [StorableClass] 38 public sealed class BestSymbolicExpressionTreeVisualizer : SingleSuccessorOperator, I SingleObjectiveSolutionsVisualizer, ISolutionsVisualizer {38 public sealed class BestSymbolicExpressionTreeVisualizer : SingleSuccessorOperator, IAnalyzer { 39 39 public ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { 40 40 get { return (ILookupParameter<ItemArray<SymbolicExpressionTree>>)Parameters["SymbolicExpressionTree"]; } … … 45 45 public ILookupParameter<SymbolicExpressionTree> BestSymbolicExpressionTreeParameter { 46 46 get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["BestSymbolicExpressionTree"]; } 47 }48 ILookupParameter ISolutionsVisualizer.VisualizationParameter {49 get { return BestSymbolicExpressionTreeParameter; }50 47 } 51 48 -
trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/IAntTrailVisualizer.cs
r3376 r3616 28 28 29 29 namespace HeuristicLab.Problems.ArtificialAnt { 30 public interface IAntTrailVisualizer : I SolutionsVisualizer, ISingleObjectiveSolutionsVisualizer {30 public interface IAntTrailVisualizer : IAnalyzer { 31 31 ILookupParameter<ItemArray<SymbolicExpressionTree>> SymbolicExpressionTreeParameter { get; } 32 32 ILookupParameter<BoolMatrix> WorldParameter { get; }
Note: See TracChangeset
for help on using the changeset viewer.