- Timestamp:
- 07/30/15 16:37:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Run.cs
r12781 r12815 1 1 using HeuristicLab.Algorithms.Bandits; 2 2 using HeuristicLab.Algorithms.GrammaticalOptimization; 3 using HeuristicLab.Algorithms.MonteCarloTreeSearch; 3 4 using HeuristicLab.Algorithms.MonteCarloTreeSearch.Base; 4 5 using HeuristicLab.Problems.GrammaticalOptimization; … … 26 27 27 28 public Run(ISymbolicExpressionTreeProblem problem, IBanditPolicy banditPolicy, ISolver solver, int runNumber, 28 int max Evaluations, int maxLen)29 int maxIterations, int maxLen) 29 30 { 30 31 Problem = problem; … … 32 33 Solver = solver; 33 34 RunNumber = runNumber; 34 Max Evaluations = maxEvaluations;35 MaxIterations = maxIterations; 35 36 MaxLen = maxLen; 36 37 38 selectionIndicators = new List<SelectionIndicator>(); 37 39 Evaluations = 0; 38 40 BestQuality = double.MinValue; 39 41 RunState = RunState.NotStarted; 40 42 FoundSolutions = new List<FoundSolution>(); 43 CurrentSelectionIndicator = new SelectionIndicator(0, 0); 41 44 42 45 BestKnownQuality = problem.BestKnownQuality(maxLen); … … 52 55 } 53 56 }; 57 if (solver is MonteCarloTreeSearch) 58 { 59 MonteCarloTreeSearch mcts = (MonteCarloTreeSearch)solver; 60 mcts.NodeSelected += mcts_NodeSelected; 61 } 62 } 63 64 private void mcts_NodeSelected(int goodSelections, int totalSelections) 65 { 66 CurrentSelectionIndicator.GoodSelections = goodSelections; 67 CurrentSelectionIndicator.TotalSelections = totalSelections; 68 this.OnPropertyChanged("CurrentSelectionIndicator"); 69 //CurrentSelectionIndicator = new SelectionIndicator(goodSelections, totalSelections); 70 //selectionIndicators.Add(CurrentSelectionIndicator); 71 } 72 73 private List<SelectionIndicator> selectionIndicators; 74 75 public List<SelectionIndicator> SelectionIndicators { get { return selectionIndicators; } } 76 77 78 private SelectionIndicator currentSelectionIndicator; 79 80 public SelectionIndicator CurrentSelectionIndicator 81 { 82 get { return this.currentSelectionIndicator; } 83 set { this.currentSelectionIndicator = value; this.OnPropertyChanged("CurrentSelectionIndicator"); } 54 84 } 55 85 … … 102 132 } 103 133 104 private int max Evaluations;105 106 public int Max Evaluations107 { 108 get { return this.max Evaluations; }109 set 110 { 111 this.max Evaluations = value;112 this.OnPropertyChanged("Max Evaluations");134 private int maxIterations; 135 136 public int MaxIterations 137 { 138 get { return this.maxIterations; } 139 set 140 { 141 this.maxIterations = value; 142 this.OnPropertyChanged("MaxIterations"); 113 143 } 114 144 } … … 297 327 protected void OnPropertyChanged(string propertyName) 298 328 { 299 if (PropertyChanged != null) 300 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 329 try 330 { 331 if (PropertyChanged != null) 332 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 333 } 334 catch (Exception) { } 301 335 } 302 336
Note: See TracChangeset
for help on using the changeset viewer.