Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2283 limit parallelism

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