Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CMAES/HeuristicLab.Algorithms.CMAEvolutionStrategy/3.3/CMAParameters.cs @ 9297

Last change on this file since 9297 was 9297, checked in by abeham, 11 years ago

#1961:

  • Improved performance of CMA-ES without ALGLIB
    • All CMA-ES parameter are standard .NET types instead of HL types
File size: 7.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25using System.Collections.Generic;
26using System.ComponentModel;
27
28namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
29  [Item("CMAParameters", "CMA-ES controls many strategy parameters that guide the search and which are combined in this class.")]
30  [StorableClass]
31  public sealed class CMAParameters : Item, INotifyPropertyChanged {
32
33    [Storable]
34    private double axisRatio;
35    public double AxisRatio {
36      get { return axisRatio; }
37      set {
38        if (axisRatio == value) return;
39        axisRatio = value;
40        OnPropertyChanged("AxisRatio");
41      }
42    }
43
44    [Storable]
45    private double sigma;
46    public double Sigma {
47      get { return sigma; }
48      set {
49        if (sigma == value) return;
50        sigma = value;
51        OnPropertyChanged("Sigma");
52      }
53    }
54
55    [Storable]
56    private double[,] sigmaBounds;
57    public double[,] SigmaBounds {
58      get { return sigmaBounds; }
59      set {
60        if (sigmaBounds == value) return;
61        sigmaBounds = value;
62        OnPropertyChanged("SigmaBounds");
63      }
64    }
65
66    [Storable]
67    private int mu;
68    public int Mu {
69      get { return mu; }
70      set {
71        if (mu == value) return;
72        mu = value;
73        OnPropertyChanged("Mu");
74      }
75    }
76
77    [Storable]
78    private double[] weights;
79    public double[] Weights {
80      get { return weights; }
81      set {
82        if (weights == value) return;
83        weights = value;
84        OnPropertyChanged("Weights");
85      }
86    }
87
88    [Storable]
89    private double muEff;
90    public double MuEff {
91      get { return muEff; }
92      set {
93        if (muEff == value) return;
94        muEff = value;
95        OnPropertyChanged("MuEff");
96      }
97    }
98
99    [Storable]
100    private double cc;
101    public double CC {
102      get { return cc; }
103      set {
104        if (cc == value) return;
105        cc = value;
106        OnPropertyChanged("CC");
107      }
108    }
109
110    [Storable]
111    private double cs;
112    public double CS {
113      get { return cs; }
114      set {
115        if (cs == value) return;
116        cs = value;
117        OnPropertyChanged("CS");
118      }
119    }
120
121    [Storable]
122    private double damps;
123    public double Damps {
124      get { return damps; }
125      set {
126        if (damps == value) return;
127        damps = value;
128        OnPropertyChanged("Damps");
129      }
130    }
131
132    [Storable]
133    private double muCov;
134    public double MuCov {
135      get { return muCov; }
136      set {
137        if (muCov == value) return;
138        muCov = value;
139        OnPropertyChanged("MuCov");
140      }
141    }
142
143    [Storable]
144    private double cCov;
145    public double CCov {
146      get { return cCov; }
147      set {
148        if (cCov == value) return;
149        cCov = value;
150        OnPropertyChanged("CCov");
151      }
152    }
153
154    [Storable]
155    private double cCovSep;
156    public double CCovSep {
157      get { return cCovSep; }
158      set {
159        if (cCovSep == value) return;
160        cCovSep = value;
161        OnPropertyChanged("CCovSep");
162      }
163    }
164
165    [Storable]
166    private double[] pc;
167    public double[] PC {
168      get { return pc; }
169      set {
170        if (pc == value) return;
171        pc = value;
172        OnPropertyChanged("PC");
173      }
174    }
175
176    [Storable]
177    private double[] ps;
178    public double[] PS {
179      get { return ps; }
180      set {
181        if (ps == value) return;
182        ps = value;
183        OnPropertyChanged("PS");
184      }
185    }
186
187    [Storable]
188    private double[,] b;
189    public double[,] B {
190      get { return b; }
191      set {
192        if (b == value) return;
193        b = value;
194        OnPropertyChanged("B");
195      }
196    }
197
198    [Storable]
199    private double[] d;
200    public double[] D {
201      get { return d; }
202      set {
203        if (d == value) return;
204        d = value;
205        OnPropertyChanged("D");
206      }
207    }
208
209    [Storable]
210    private double[,] c;
211    public double[,] C {
212      get { return c; }
213      set {
214        if (c == value) return;
215        c = value;
216        OnPropertyChanged("C");
217      }
218    }
219
220    [Storable]
221    private double[] bDz;
222    public double[] BDz {
223      get { return bDz; }
224      set {
225        if (bDz == value) return;
226        bDz = value;
227        OnPropertyChanged("BDz");
228      }
229    }
230
231    [Storable]
232    private double chiN;
233    public double ChiN {
234      get { return chiN; }
235      set {
236        if (chiN == value) return;
237        chiN = value;
238        OnPropertyChanged("ChiN");
239      }
240    }
241
242    [Storable]
243    private int initialIterations;
244    public int InitialIterations {
245      get { return initialIterations; }
246      set {
247        if (initialIterations == value) return;
248        initialIterations = value;
249        OnPropertyChanged("InitialIterations");
250      }
251    }
252
253    [Storable(Name = "qualityHistory")]
254    private IEnumerable<double> StorableQualityHistory {
255      get { return qualityHistory.ToArray(); }
256      set { qualityHistory = new Queue<double>(value); }
257    }
258
259    private Queue<double> qualityHistory;
260    public Queue<double> QualityHistory {
261      get { return qualityHistory; }
262      set { qualityHistory = value; }
263    }
264
265    [Storable]
266    private int qualityHistorySize;
267    public int QualityHistorySize {
268      get { return qualityHistorySize; }
269      set { qualityHistorySize = value; }
270    }
271
272    [StorableConstructor]
273    private CMAParameters(bool deserializing) : base(deserializing) { }
274    private CMAParameters(CMAParameters original, Cloner cloner)
275      : base(original, cloner) {
276      this.axisRatio = original.axisRatio;
277      this.b = (double[,])original.b.Clone();
278      this.bDz = (double[])original.bDz.Clone();
279      this.c = (double[,])original.c.Clone();
280      this.cCov = original.cCov;
281      this.cCovSep = original.cCovSep;
282      this.cc = original.cc;
283      this.chiN = original.chiN;
284      this.cs = original.cs;
285      this.d = (double[])original.d.Clone();
286      this.damps = original.damps;
287      this.initialIterations = original.initialIterations;
288      this.mu = original.mu;
289      this.muCov = original.muCov;
290      this.muEff = original.muEff;
291      this.pc = (double[])original.pc.Clone();
292      this.ps = (double[])original.ps.Clone();
293      this.sigma = original.sigma;
294      this.sigmaBounds = (double[,])original.sigmaBounds.Clone();
295      this.weights = (double[])original.weights.Clone();
296
297      this.qualityHistory = new Queue<double>(original.qualityHistory);
298      this.qualityHistorySize = original.qualityHistorySize;
299    }
300    public CMAParameters() { }
301
302    public override IDeepCloneable Clone(Cloner cloner) {
303      return new CMAParameters(this, cloner);
304    }
305
306    public event PropertyChangedEventHandler PropertyChanged;
307    private void OnPropertyChanged(string name) {
308      var handler = PropertyChanged;
309      if (handler != null) handler(this, new PropertyChangedEventArgs(name));
310    }
311  }
312}
Note: See TracBrowser for help on using the repository browser.