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.Collections.ObjectModel;
|
---|
9 | using System.ComponentModel;
|
---|
10 | using System.Linq;
|
---|
11 |
|
---|
12 | namespace Evaluation.ViewModel
|
---|
13 | {
|
---|
14 | public class EvaluationViewModel : INotifyPropertyChanged
|
---|
15 | {
|
---|
16 | private List<ISymbolicExpressionTreeProblem> problems;
|
---|
17 |
|
---|
18 | public List<ISymbolicExpressionTreeProblem> Problems
|
---|
19 | {
|
---|
20 | get { return this.problems; }
|
---|
21 | set
|
---|
22 | {
|
---|
23 | this.problems = value;
|
---|
24 | this.OnPropertyChanged("Problems");
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | private ISymbolicExpressionTreeProblem selectedProblem;
|
---|
29 |
|
---|
30 | public ISymbolicExpressionTreeProblem SelectedProblem
|
---|
31 | {
|
---|
32 | get { return this.selectedProblem; }
|
---|
33 | set
|
---|
34 | {
|
---|
35 | this.selectedProblem = value;
|
---|
36 | this.OnPropertyChanged("SelectedProblem");
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | private List<Type> algorithms;
|
---|
41 |
|
---|
42 | public List<Type> Algorithms
|
---|
43 | {
|
---|
44 | get { return this.algorithms; }
|
---|
45 | set
|
---|
46 | {
|
---|
47 | this.algorithms = value;
|
---|
48 | this.OnPropertyChanged("Algorithms");
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | private Type selectedAlgorithm;
|
---|
53 |
|
---|
54 | public Type SelectedAlgorithm
|
---|
55 | {
|
---|
56 | get { return this.selectedAlgorithm; }
|
---|
57 | set
|
---|
58 | {
|
---|
59 | this.selectedAlgorithm = value;
|
---|
60 | this.OnPropertyChanged("SelectedAlgorithm");
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 | private List<Type> policies;
|
---|
65 |
|
---|
66 | public List<Type> Policies
|
---|
67 | {
|
---|
68 | get { return this.policies; }
|
---|
69 | set
|
---|
70 | {
|
---|
71 | this.policies = value;
|
---|
72 | this.OnPropertyChanged("Policies");
|
---|
73 | }
|
---|
74 | }
|
---|
75 |
|
---|
76 | private Type selectedPolicy;
|
---|
77 |
|
---|
78 | public Type SelectedPolicy
|
---|
79 | {
|
---|
80 | get { return this.selectedPolicy; }
|
---|
81 | set { this.selectedPolicy = value; this.OnPropertyChanged("SelectedPolicy"); }
|
---|
82 | }
|
---|
83 |
|
---|
84 | private int nrRuns;
|
---|
85 |
|
---|
86 | public int NrRuns
|
---|
87 | {
|
---|
88 | get { return this.nrRuns; }
|
---|
89 | set { this.nrRuns = value; this.OnPropertyChanged("NrRuns"); }
|
---|
90 | }
|
---|
91 |
|
---|
92 | private int maxLen;
|
---|
93 |
|
---|
94 | public int MaxLen
|
---|
95 | {
|
---|
96 | get { return this.maxLen; }
|
---|
97 | set { this.maxLen = value; this.OnPropertyChanged("MaxLen"); }
|
---|
98 | }
|
---|
99 |
|
---|
100 | private int maxIterations;
|
---|
101 |
|
---|
102 | public int MaxIterations
|
---|
103 | {
|
---|
104 | get { return this.maxIterations; }
|
---|
105 | set
|
---|
106 | {
|
---|
107 | this.maxIterations = value;
|
---|
108 | this.OnPropertyChanged("MaxIterations");
|
---|
109 | }
|
---|
110 | }
|
---|
111 |
|
---|
112 | private int maxThreads;
|
---|
113 |
|
---|
114 | public int MaxThreads
|
---|
115 | {
|
---|
116 | get { return this.maxThreads; }
|
---|
117 | set
|
---|
118 | {
|
---|
119 | this.maxThreads = value;
|
---|
120 | this.OnPropertyChanged("MaxThreads");
|
---|
121 | }
|
---|
122 | }
|
---|
123 |
|
---|
124 | private double _policyParameter;
|
---|
125 |
|
---|
126 | public double PolicyParameter
|
---|
127 | {
|
---|
128 | get { return this._policyParameter; }
|
---|
129 | set
|
---|
130 | {
|
---|
131 | this._policyParameter = value;
|
---|
132 | this.OnPropertyChanged("PolicyParameter");
|
---|
133 | }
|
---|
134 | }
|
---|
135 |
|
---|
136 | private ObservableCollection<Run> runs = new ObservableCollection<Run>();
|
---|
137 |
|
---|
138 | public ObservableCollection<Run> Runs
|
---|
139 | {
|
---|
140 | get { return this.runs; }
|
---|
141 | set
|
---|
142 | {
|
---|
143 | runs = value;
|
---|
144 | this.OnPropertyChanged("Runs");
|
---|
145 | }
|
---|
146 | }
|
---|
147 |
|
---|
148 | private Run selectedRun;
|
---|
149 |
|
---|
150 | public Run SelectedRun
|
---|
151 | {
|
---|
152 | get { return this.selectedRun; }
|
---|
153 | set
|
---|
154 | {
|
---|
155 | selectedRun = value;
|
---|
156 | this.OnPropertyChanged("SelectedRun");
|
---|
157 | }
|
---|
158 | }
|
---|
159 |
|
---|
160 | private string completedRuns;
|
---|
161 |
|
---|
162 | public string CompletedRuns
|
---|
163 | {
|
---|
164 | get { return this.completedRuns; }
|
---|
165 | set
|
---|
166 | {
|
---|
167 | completedRuns = value;
|
---|
168 | this.OnPropertyChanged("CompletedRuns");
|
---|
169 | }
|
---|
170 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | public EvaluationViewModel()
|
---|
174 | {
|
---|
175 | InitializeProblems();
|
---|
176 | InitializeAlgorithms();
|
---|
177 | InitializePolicies();
|
---|
178 | }
|
---|
179 |
|
---|
180 | private void InitializePolicies()
|
---|
181 | {
|
---|
182 | this.policies = new List<Type>();
|
---|
183 | this.policies.Add(typeof(ActiveLearningPolicy));
|
---|
184 | this.policies.Add(typeof(BernoulliThompsonSamplingPolicy));
|
---|
185 | this.policies.Add(typeof(BoltzmannExplorationPolicy));
|
---|
186 | this.policies.Add(typeof(EpsGreedyPolicy));
|
---|
187 | this.policies.Add(typeof(GenericThompsonSamplingPolicy));
|
---|
188 | this.policies.Add(typeof(ModifiedUCTPolicy));
|
---|
189 | this.policies.Add(typeof(RandomPolicy));
|
---|
190 | this.policies.Add(typeof(ThresholdAscentPolicy));
|
---|
191 | this.policies.Add(typeof(UCB1Policy));
|
---|
192 | this.policies.Add(typeof(UCB1TunedPolicy));
|
---|
193 | this.policies.Add(typeof(UCBNormalPolicy));
|
---|
194 | this.policies.Add(typeof(UCTPolicy));
|
---|
195 |
|
---|
196 | this.selectedPolicy = typeof(UCB1Policy);
|
---|
197 | }
|
---|
198 |
|
---|
199 | private void InitializeAlgorithms()
|
---|
200 | {
|
---|
201 | this.algorithms = new List<Type>();
|
---|
202 | this.algorithms.Add(typeof(RandomSearch));
|
---|
203 | this.algorithms.Add(typeof(SequentialSearch));
|
---|
204 | this.algorithms.Add(typeof(MonteCarloTreeSearch));
|
---|
205 | this.algorithms.Add(typeof(MonteCarloTreeSearch_PruneLeaves));
|
---|
206 | this.algorithms.Add(typeof(StandardGP));
|
---|
207 | this.algorithms.Add(typeof(OffspringSelectionGP));
|
---|
208 |
|
---|
209 | this.selectedAlgorithm = typeof(MonteCarloTreeSearch_PruneLeaves);
|
---|
210 | }
|
---|
211 |
|
---|
212 | private void InitializeProblems()
|
---|
213 | {
|
---|
214 | this.problems = new List<ISymbolicExpressionTreeProblem>();
|
---|
215 | this.problems.Add(new SymbolicRegressionPoly10Problem());
|
---|
216 | this.problems.Add(new SantaFeAntProblem());
|
---|
217 | this.problems.Add(new EvenParityProblem());
|
---|
218 | this.problems.Add(new RoyalPairProblem());
|
---|
219 | this.problems.Add(new PalindromeProblem());
|
---|
220 | this.problems.Add(new PermutationProblem());
|
---|
221 | this.problems.Add(new RoyalSymbolProblem());
|
---|
222 | // TODO: still some missing...
|
---|
223 |
|
---|
224 | this.selectedProblem = problems.FirstOrDefault();
|
---|
225 | }
|
---|
226 |
|
---|
227 | #region INotifyPropertyChanged members
|
---|
228 |
|
---|
229 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
230 |
|
---|
231 | protected void OnPropertyChanged(string propertyName)
|
---|
232 | {
|
---|
233 | if (PropertyChanged != null)
|
---|
234 | this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
---|
235 | }
|
---|
236 |
|
---|
237 | #endregion INotifyPropertyChanged members
|
---|
238 | }
|
---|
239 | }
|
---|