Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs @ 12781

Last change on this file since 12781 was 12781, checked in by aballeit, 9 years ago

#2283 stable GUI; ThreadPool for runs; improved TreeAnalysis

File size: 7.4 KB
Line 
1using HeuristicLab.Algorithms.Bandits.BanditPolicies;
2using HeuristicLab.Algorithms.GeneticProgramming;
3using HeuristicLab.Algorithms.GrammaticalOptimization;
4using HeuristicLab.Algorithms.MonteCarloTreeSearch;
5using HeuristicLab.Problems.GrammaticalOptimization;
6using System;
7using System.Collections.Generic;
8using System.Collections.ObjectModel;
9using System.ComponentModel;
10using System.Linq;
11
12namespace 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 maxEvaluations;
101
102        public int MaxEvaluations
103        {
104            get { return this.maxEvaluations; }
105            set
106            {
107                this.maxEvaluations = value;
108                this.OnPropertyChanged("MaxEvaluations");
109            }
110        }
111
112        private string headerString;
113
114        public string HeaderString
115        {
116            get { return this.headerString; }
117            set
118            {
119                headerString = value;
120                this.OnPropertyChanged("HeaderString");
121            }
122        }
123
124        private string verticalAxisString;
125
126        public string VerticalAxisString
127        {
128            get { return this.verticalAxisString; }
129            set
130            {
131                verticalAxisString = value;
132                this.OnPropertyChanged("VerticalAxisString");
133            }
134        }
135
136        private string horizontalAxisString;
137
138        public string HorizontalAxisString
139        {
140            get { return this.horizontalAxisString; }
141            set
142            {
143                horizontalAxisString = value;
144                this.OnPropertyChanged("HorizontalAxisString");
145            }
146        }
147
148        private ObservableCollection<Run> runs = new ObservableCollection<Run>();
149
150        public ObservableCollection<Run> Runs
151        {
152            get { return this.runs; }
153            set
154            {
155                runs = value;
156                this.OnPropertyChanged("Runs");
157            }
158        }
159
160        private Run selectedRun;
161
162        public Run SelectedRun
163        {
164            get { return this.selectedRun; }
165            set
166            {
167                selectedRun = value;
168                this.OnPropertyChanged("SelectedRun");
169            }
170        }
171
172        private string completedRuns;
173
174        public string CompletedRuns
175        {
176            get { return this.completedRuns; }
177            set
178            {
179                completedRuns = value;
180                this.OnPropertyChanged("CompletedRuns");
181            }
182        }
183
184
185        public EvaluationViewModel()
186        {
187            InitializeProblems();
188            InitializeAlgorithms();
189            InitializePolicies();
190        }
191
192        private void InitializePolicies()
193        {
194            this.policies = new List<Type>();
195            this.policies.Add(typeof(ActiveLearningPolicy));
196            this.policies.Add(typeof(BernoulliThompsonSamplingPolicy));
197            this.policies.Add(typeof(BoltzmannExplorationPolicy));
198            this.policies.Add(typeof(EpsGreedyPolicy));
199            this.policies.Add(typeof(GenericThompsonSamplingPolicy));
200            this.policies.Add(typeof(ModifiedUCTPolicy));
201            this.policies.Add(typeof(RandomPolicy));
202            this.policies.Add(typeof(ThresholdAscentPolicy));
203            this.policies.Add(typeof(UCB1Policy));
204            this.policies.Add(typeof(UCB1TunedPolicy));
205            this.policies.Add(typeof(UCBNormalPolicy));
206            this.policies.Add(typeof(UCTPolicy));
207
208            this.selectedPolicy = typeof(UCB1Policy);
209        }
210
211        private void InitializeAlgorithms()
212        {
213            this.algorithms = new List<Type>();
214            this.algorithms.Add(typeof(RandomSearch));
215            this.algorithms.Add(typeof(SequentialSearch));
216            this.algorithms.Add(typeof(MonteCarloTreeSearch));
217            this.algorithms.Add(typeof(MonteCarloTreeSearch_PruneLeaves));
218            this.algorithms.Add(typeof(StandardGP));
219            this.algorithms.Add(typeof(OffspringSelectionGP));
220
221            this.selectedAlgorithm = typeof(MonteCarloTreeSearch_PruneLeaves);
222        }
223
224        private void InitializeProblems()
225        {
226            this.problems = new List<ISymbolicExpressionTreeProblem>();
227            this.problems.Add(new SymbolicRegressionPoly10Problem());
228            this.problems.Add(new SantaFeAntProblem());
229            this.problems.Add(new EvenParityProblem());
230            this.problems.Add(new RoyalPairProblem());
231            this.problems.Add(new PalindromeProblem());
232            this.problems.Add(new PermutationProblem());
233            this.problems.Add(new RoyalSymbolProblem());
234            // TODO: still some missing...
235
236            this.selectedProblem = problems.FirstOrDefault();
237        }
238
239        #region INotifyPropertyChanged members
240
241        public event PropertyChangedEventHandler PropertyChanged;
242
243        protected void OnPropertyChanged(string propertyName)
244        {
245            if (PropertyChanged != null)
246                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
247        }
248
249        #endregion INotifyPropertyChanged members
250    }
251}
Note: See TracBrowser for help on using the repository browser.