Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2283 added SelectionIndicator for MCTS and problems SantaFeAnt, SymbolicRegression10, RoyalSymbol; updated SantaFeAnt grammar

File size: 6.5 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 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 ObservableCollection<Run> runs = new ObservableCollection<Run>();
113
114        public ObservableCollection<Run> Runs
115        {
116            get { return this.runs; }
117            set
118            {
119                runs = value;
120                this.OnPropertyChanged("Runs");
121            }
122        }
123
124        private Run selectedRun;
125
126        public Run SelectedRun
127        {
128            get { return this.selectedRun; }
129            set
130            {
131                selectedRun = value;
132                this.OnPropertyChanged("SelectedRun");
133            }
134        }
135
136        private string completedRuns;
137
138        public string CompletedRuns
139        {
140            get { return this.completedRuns; }
141            set
142            {
143                completedRuns = value;
144                this.OnPropertyChanged("CompletedRuns");
145            }
146        }
147
148
149        public EvaluationViewModel()
150        {
151            InitializeProblems();
152            InitializeAlgorithms();
153            InitializePolicies();
154        }
155
156        private void InitializePolicies()
157        {
158            this.policies = new List<Type>();
159            this.policies.Add(typeof(ActiveLearningPolicy));
160            this.policies.Add(typeof(BernoulliThompsonSamplingPolicy));
161            this.policies.Add(typeof(BoltzmannExplorationPolicy));
162            this.policies.Add(typeof(EpsGreedyPolicy));
163            this.policies.Add(typeof(GenericThompsonSamplingPolicy));
164            this.policies.Add(typeof(ModifiedUCTPolicy));
165            this.policies.Add(typeof(RandomPolicy));
166            this.policies.Add(typeof(ThresholdAscentPolicy));
167            this.policies.Add(typeof(UCB1Policy));
168            this.policies.Add(typeof(UCB1TunedPolicy));
169            this.policies.Add(typeof(UCBNormalPolicy));
170            this.policies.Add(typeof(UCTPolicy));
171
172            this.selectedPolicy = typeof(UCB1Policy);
173        }
174
175        private void InitializeAlgorithms()
176        {
177            this.algorithms = new List<Type>();
178            this.algorithms.Add(typeof(RandomSearch));
179            this.algorithms.Add(typeof(SequentialSearch));
180            this.algorithms.Add(typeof(MonteCarloTreeSearch));
181            this.algorithms.Add(typeof(MonteCarloTreeSearch_PruneLeaves));
182            this.algorithms.Add(typeof(StandardGP));
183            this.algorithms.Add(typeof(OffspringSelectionGP));
184
185            this.selectedAlgorithm = typeof(MonteCarloTreeSearch_PruneLeaves);
186        }
187
188        private void InitializeProblems()
189        {
190            this.problems = new List<ISymbolicExpressionTreeProblem>();
191            this.problems.Add(new SymbolicRegressionPoly10Problem());
192            this.problems.Add(new SantaFeAntProblem());
193            this.problems.Add(new EvenParityProblem());
194            this.problems.Add(new RoyalPairProblem());
195            this.problems.Add(new PalindromeProblem());
196            this.problems.Add(new PermutationProblem());
197            this.problems.Add(new RoyalSymbolProblem());
198            // TODO: still some missing...
199
200            this.selectedProblem = problems.FirstOrDefault();
201        }
202
203        #region INotifyPropertyChanged members
204
205        public event PropertyChangedEventHandler PropertyChanged;
206
207        protected void OnPropertyChanged(string propertyName)
208        {
209            if (PropertyChanged != null)
210                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
211        }
212
213        #endregion INotifyPropertyChanged members
214    }
215}
Note: See TracBrowser for help on using the repository browser.