1 | using HeuristicLab.Algorithms.Bandits.BanditPolicies;
|
---|
2 | using HeuristicLab.Algorithms.GeneticProgramming;
|
---|
3 | using HeuristicLab.Algorithms.GrammaticalOptimization;
|
---|
4 | using HeuristicLab.Algorithms.MonteCarloTreeSearch;
|
---|
5 | using HeuristicLab.Problems.GrammaticalOptimization;
|
---|
6 | using System;
|
---|
7 | using System.Collections.Generic;
|
---|
8 | using System.ComponentModel;
|
---|
9 | using System.Linq;
|
---|
10 | using System.Text;
|
---|
11 | using System.Threading.Tasks;
|
---|
12 | using HeuristicLab.Problems.GrammaticalOptimization.SymbReg;
|
---|
13 |
|
---|
14 | namespace Evaluation.ViewModel
|
---|
15 | {
|
---|
16 | public class EvaluationViewModel : INotifyPropertyChanged
|
---|
17 | {
|
---|
18 | private List<ISymbolicExpressionTreeProblem> problems;
|
---|
19 |
|
---|
20 | public List<ISymbolicExpressionTreeProblem> Problems
|
---|
21 | {
|
---|
22 | get { return this.problems; }
|
---|
23 | set
|
---|
24 | {
|
---|
25 | this.problems = value;
|
---|
26 | this.OnPropertyChanged("Problems");
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | private ISymbolicExpressionTreeProblem selectedProblem;
|
---|
31 |
|
---|
32 | public ISymbolicExpressionTreeProblem SelectedProblem
|
---|
33 | {
|
---|
34 | get { return this.selectedProblem; }
|
---|
35 | set
|
---|
36 | {
|
---|
37 | this.selectedProblem = value;
|
---|
38 | this.OnPropertyChanged("SelectedProblem");
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | private List<Type> algorithms;
|
---|
43 |
|
---|
44 | public List<Type> Algorithms
|
---|
45 | {
|
---|
46 | get { return this.algorithms; }
|
---|
47 | set
|
---|
48 | {
|
---|
49 | this.algorithms = value;
|
---|
50 | this.OnPropertyChanged("Algorithms");
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | private Type selectedAlgorithm;
|
---|
55 |
|
---|
56 | public Type SelectedAlgorithm
|
---|
57 | {
|
---|
58 | get { return this.selectedAlgorithm; }
|
---|
59 | set
|
---|
60 | {
|
---|
61 | this.selectedAlgorithm = value;
|
---|
62 | this.OnPropertyChanged("SelectedAlgorithm");
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 | private List<Type> policies;
|
---|
67 |
|
---|
68 | public List<Type> Policies
|
---|
69 | {
|
---|
70 | get { return this.policies; }
|
---|
71 | set
|
---|
72 | {
|
---|
73 | this.policies = value;
|
---|
74 | this.OnPropertyChanged("Policies");
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | private Type selectedPolicy;
|
---|
79 |
|
---|
80 | public Type SelectedPolicy
|
---|
81 | {
|
---|
82 | get { return this.selectedPolicy; }
|
---|
83 | set { this.selectedPolicy = value; this.OnPropertyChanged("SelectedPolicy"); }
|
---|
84 | }
|
---|
85 |
|
---|
86 | private double bestKnownQuality;
|
---|
87 |
|
---|
88 | public double BestKnownQuality
|
---|
89 | {
|
---|
90 | get { return this.bestKnownQuality; }
|
---|
91 | set
|
---|
92 | {
|
---|
93 | this.bestKnownQuality = value;
|
---|
94 | this.OnPropertyChanged("BestKnownQuality");
|
---|
95 | }
|
---|
96 | }
|
---|
97 |
|
---|
98 | private double currentBestQuality;
|
---|
99 |
|
---|
100 | public double CurrentBestQuality
|
---|
101 | {
|
---|
102 | get { return this.currentBestQuality; }
|
---|
103 | set
|
---|
104 | {
|
---|
105 | this.currentBestQuality = value;
|
---|
106 | this.OnPropertyChanged("CurrentBestQuality");
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | private long evaluations;
|
---|
111 |
|
---|
112 | public long Evaluations
|
---|
113 | {
|
---|
114 | get { return this.evaluations; }
|
---|
115 | set
|
---|
116 | {
|
---|
117 | this.evaluations = value;
|
---|
118 | this.OnPropertyChanged("Evaluations");
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | private int maxLen;
|
---|
123 |
|
---|
124 | public int MaxLen
|
---|
125 | {
|
---|
126 | get { return this.maxLen; }
|
---|
127 | set { this.maxLen = value; this.OnPropertyChanged("MaxLen"); }
|
---|
128 | }
|
---|
129 |
|
---|
130 | private int maxEvaluations;
|
---|
131 |
|
---|
132 | public int MaxEvaluations
|
---|
133 | {
|
---|
134 | get { return this.maxEvaluations; }
|
---|
135 | set
|
---|
136 | {
|
---|
137 | this.maxEvaluations = value;
|
---|
138 | this.OnPropertyChanged("MaxEvaluations");
|
---|
139 | }
|
---|
140 | }
|
---|
141 |
|
---|
142 | private string headerString;
|
---|
143 |
|
---|
144 | public string HeaderString
|
---|
145 | {
|
---|
146 | get { return this.headerString; }
|
---|
147 | set
|
---|
148 | {
|
---|
149 | headerString = value;
|
---|
150 | this.OnPropertyChanged("HeaderString");
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | private string verticalAxisString;
|
---|
155 |
|
---|
156 | public string VerticalAxisString
|
---|
157 | {
|
---|
158 | get { return this.verticalAxisString; }
|
---|
159 | set
|
---|
160 | {
|
---|
161 | verticalAxisString = value;
|
---|
162 | this.OnPropertyChanged("VerticalAxisString");
|
---|
163 | }
|
---|
164 | }
|
---|
165 |
|
---|
166 | private string horizontalAxisString;
|
---|
167 |
|
---|
168 | public string HorizontalAxisString
|
---|
169 | {
|
---|
170 | get { return this.horizontalAxisString; }
|
---|
171 | set
|
---|
172 | {
|
---|
173 | horizontalAxisString = value;
|
---|
174 | this.OnPropertyChanged("HorizontalAxisString");
|
---|
175 | }
|
---|
176 | }
|
---|
177 |
|
---|
178 | private double evaluationsPerSec;
|
---|
179 |
|
---|
180 | public double EvaluationsPerSec
|
---|
181 | {
|
---|
182 | get { return this.evaluationsPerSec; }
|
---|
183 | set
|
---|
184 | {
|
---|
185 | evaluationsPerSec = value;
|
---|
186 | this.OnPropertyChanged("EvaluationsPerSec");
|
---|
187 | }
|
---|
188 | }
|
---|
189 |
|
---|
190 | private long bestSolutionFoundAt;
|
---|
191 |
|
---|
192 | public long BestSolutionFoundAt
|
---|
193 | {
|
---|
194 | get { return this.bestSolutionFoundAt; }
|
---|
195 | set
|
---|
196 | {
|
---|
197 | bestSolutionFoundAt = value;
|
---|
198 | this.OnPropertyChanged("BestSolutionFoundAt");
|
---|
199 | }
|
---|
200 | }
|
---|
201 |
|
---|
202 |
|
---|
203 | public EvaluationViewModel()
|
---|
204 | {
|
---|
205 | InitializeProblems();
|
---|
206 | InitializeAlgorithms();
|
---|
207 | InitializePolicies();
|
---|
208 | }
|
---|
209 |
|
---|
210 | private void InitializePolicies()
|
---|
211 | {
|
---|
212 | this.policies = new List<Type>();
|
---|
213 | this.policies.Add(typeof(ActiveLearningPolicy));
|
---|
214 | this.policies.Add(typeof(BernoulliThompsonSamplingPolicy));
|
---|
215 | this.policies.Add(typeof(BoltzmannExplorationPolicy));
|
---|
216 | this.policies.Add(typeof(EpsGreedyPolicy));
|
---|
217 | this.policies.Add(typeof(GenericThompsonSamplingPolicy));
|
---|
218 | this.policies.Add(typeof(ModifiedUCTPolicy));
|
---|
219 | this.policies.Add(typeof(RandomPolicy));
|
---|
220 | this.policies.Add(typeof(ThresholdAscentPolicy));
|
---|
221 | this.policies.Add(typeof(UCB1Policy));
|
---|
222 | this.policies.Add(typeof(UCB1TunedPolicy));
|
---|
223 | this.policies.Add(typeof(UCBNormalPolicy));
|
---|
224 | this.policies.Add(typeof(UCTPolicy));
|
---|
225 |
|
---|
226 | this.selectedPolicy = typeof(UCB1Policy);
|
---|
227 | }
|
---|
228 |
|
---|
229 | private void InitializeAlgorithms()
|
---|
230 | {
|
---|
231 | this.algorithms = new List<Type>();
|
---|
232 | this.algorithms.Add(typeof(RandomSearch));
|
---|
233 | this.algorithms.Add(typeof(SequentialSearch));
|
---|
234 | this.algorithms.Add(typeof(MonteCarloTreeSearch));
|
---|
235 | this.algorithms.Add(typeof(StandardGP));
|
---|
236 | this.algorithms.Add(typeof(OffspringSelectionGP));
|
---|
237 |
|
---|
238 | this.selectedAlgorithm = typeof(MonteCarloTreeSearch);
|
---|
239 | }
|
---|
240 |
|
---|
241 | private void InitializeProblems()
|
---|
242 | {
|
---|
243 | this.problems = new List<ISymbolicExpressionTreeProblem>();
|
---|
244 | this.problems.Add(new SymbolicRegressionPoly10Problem());
|
---|
245 | this.problems.Add(new SantaFeAntProblem());
|
---|
246 | this.problems.Add(new EvenParityProblem());
|
---|
247 | this.problems.Add(new RoyalPairProblem());
|
---|
248 | this.problems.Add(new PalindromeProblem());
|
---|
249 | this.problems.Add(new PermutationProblem());
|
---|
250 | this.problems.Add(new RoyalSymbolProblem());
|
---|
251 | // TODO: still some missing...
|
---|
252 |
|
---|
253 | this.selectedProblem = problems.FirstOrDefault();
|
---|
254 | }
|
---|
255 |
|
---|
256 | #region INotifyPropertyChanged members
|
---|
257 |
|
---|
258 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
259 |
|
---|
260 | protected void OnPropertyChanged(string propertyName)
|
---|
261 | {
|
---|
262 | if (PropertyChanged != null)
|
---|
263 | this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
---|
264 | }
|
---|
265 |
|
---|
266 | #endregion INotifyPropertyChanged members
|
---|
267 | }
|
---|
268 | }
|
---|