[12781] | 1 | using HeuristicLab.Algorithms.Bandits.BanditPolicies;
|
---|
[12503] | 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;
|
---|
[12781] | 8 | using System.Collections.ObjectModel;
|
---|
[12503] | 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 |
|
---|
[12762] | 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 |
|
---|
[12503] | 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 |
|
---|
[12815] | 100 | private int maxIterations;
|
---|
[12503] | 101 |
|
---|
[12815] | 102 | public int MaxIterations
|
---|
[12503] | 103 | {
|
---|
[12815] | 104 | get { return this.maxIterations; }
|
---|
[12503] | 105 | set
|
---|
| 106 | {
|
---|
[12815] | 107 | this.maxIterations = value;
|
---|
| 108 | this.OnPropertyChanged("MaxIterations");
|
---|
[12503] | 109 | }
|
---|
| 110 | }
|
---|
| 111 |
|
---|
[12832] | 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 |
|
---|
[13518] | 124 | private double _policyParameter;
|
---|
[12833] | 125 |
|
---|
[13518] | 126 | public double PolicyParameter
|
---|
[12833] | 127 | {
|
---|
[13518] | 128 | get { return this._policyParameter; }
|
---|
[12833] | 129 | set
|
---|
| 130 | {
|
---|
[13518] | 131 | this._policyParameter = value;
|
---|
| 132 | this.OnPropertyChanged("PolicyParameter");
|
---|
[12833] | 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
[12781] | 136 | private ObservableCollection<Run> runs = new ObservableCollection<Run>();
|
---|
[12762] | 137 |
|
---|
[12781] | 138 | public ObservableCollection<Run> Runs
|
---|
[12762] | 139 | {
|
---|
[12781] | 140 | get { return this.runs; }
|
---|
[12762] | 141 | set
|
---|
| 142 | {
|
---|
[12781] | 143 | runs = value;
|
---|
| 144 | this.OnPropertyChanged("Runs");
|
---|
[12762] | 145 | }
|
---|
| 146 | }
|
---|
| 147 |
|
---|
[12781] | 148 | private Run selectedRun;
|
---|
[12503] | 149 |
|
---|
[12781] | 150 | public Run SelectedRun
|
---|
[12503] | 151 | {
|
---|
[12781] | 152 | get { return this.selectedRun; }
|
---|
[12503] | 153 | set
|
---|
| 154 | {
|
---|
[12781] | 155 | selectedRun = value;
|
---|
| 156 | this.OnPropertyChanged("SelectedRun");
|
---|
[12503] | 157 | }
|
---|
| 158 | }
|
---|
| 159 |
|
---|
[12781] | 160 | private string completedRuns;
|
---|
[12503] | 161 |
|
---|
[12781] | 162 | public string CompletedRuns
|
---|
[12503] | 163 | {
|
---|
[12781] | 164 | get { return this.completedRuns; }
|
---|
[12503] | 165 | set
|
---|
| 166 | {
|
---|
[12781] | 167 | completedRuns = value;
|
---|
| 168 | this.OnPropertyChanged("CompletedRuns");
|
---|
[12503] | 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));
|
---|
[12781] | 205 | this.algorithms.Add(typeof(MonteCarloTreeSearch_PruneLeaves));
|
---|
[12503] | 206 | this.algorithms.Add(typeof(StandardGP));
|
---|
| 207 | this.algorithms.Add(typeof(OffspringSelectionGP));
|
---|
| 208 |
|
---|
[12781] | 209 | this.selectedAlgorithm = typeof(MonteCarloTreeSearch_PruneLeaves);
|
---|
[12503] | 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 | }
|
---|