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 |
|
---|
22 | using HeuristicLab.Common;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
26 | using System.Collections.Generic;
|
---|
27 | using System.ComponentModel;
|
---|
28 |
|
---|
29 | namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
|
---|
30 | [Item("CMAParameters", "CMA-ES controls many strategy parameters that guide the search and which are combined in this class.")]
|
---|
31 | [StorableClass]
|
---|
32 | public sealed class CMAParameters : Item, INotifyPropertyChanged {
|
---|
33 |
|
---|
34 | [Storable]
|
---|
35 | private DoubleValue axisRatio;
|
---|
36 | public DoubleValue AxisRatio {
|
---|
37 | get { return axisRatio; }
|
---|
38 | set {
|
---|
39 | if (axisRatio == value) return;
|
---|
40 | axisRatio = value;
|
---|
41 | OnPropertyChanged("AxisRatio");
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | [Storable]
|
---|
46 | private DoubleValue sigma;
|
---|
47 | public DoubleValue Sigma {
|
---|
48 | get { return sigma; }
|
---|
49 | set {
|
---|
50 | if (sigma == value) return;
|
---|
51 | sigma = value;
|
---|
52 | OnPropertyChanged("Sigma");
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | [Storable]
|
---|
57 | private DoubleMatrix sigmaBounds;
|
---|
58 | public DoubleMatrix SigmaBounds {
|
---|
59 | get { return sigmaBounds; }
|
---|
60 | set {
|
---|
61 | if (sigmaBounds == value) return;
|
---|
62 | sigmaBounds = value;
|
---|
63 | OnPropertyChanged("SigmaBounds");
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | [Storable]
|
---|
68 | private IntValue mu;
|
---|
69 | public IntValue Mu {
|
---|
70 | get { return mu; }
|
---|
71 | set {
|
---|
72 | if (mu == value) return;
|
---|
73 | mu = value;
|
---|
74 | OnPropertyChanged("Mu");
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | [Storable]
|
---|
79 | private DoubleArray weights;
|
---|
80 | public DoubleArray Weights {
|
---|
81 | get { return weights; }
|
---|
82 | set {
|
---|
83 | if (weights == value) return;
|
---|
84 | weights = value;
|
---|
85 | OnPropertyChanged("Weights");
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | [Storable]
|
---|
90 | private DoubleValue muEff;
|
---|
91 | public DoubleValue MuEff {
|
---|
92 | get { return muEff; }
|
---|
93 | set {
|
---|
94 | if (muEff == value) return;
|
---|
95 | muEff = value;
|
---|
96 | OnPropertyChanged("MuEff");
|
---|
97 | }
|
---|
98 | }
|
---|
99 |
|
---|
100 | [Storable]
|
---|
101 | private DoubleValue cc;
|
---|
102 | public DoubleValue CC {
|
---|
103 | get { return cc; }
|
---|
104 | set {
|
---|
105 | if (cc == value) return;
|
---|
106 | cc = value;
|
---|
107 | OnPropertyChanged("CC");
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | [Storable]
|
---|
112 | private DoubleValue cs;
|
---|
113 | public DoubleValue CS {
|
---|
114 | get { return cs; }
|
---|
115 | set {
|
---|
116 | if (cs == value) return;
|
---|
117 | cs = value;
|
---|
118 | OnPropertyChanged("CS");
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | [Storable]
|
---|
123 | private DoubleValue damps;
|
---|
124 | public DoubleValue Damps {
|
---|
125 | get { return damps; }
|
---|
126 | set {
|
---|
127 | if (damps == value) return;
|
---|
128 | damps = value;
|
---|
129 | OnPropertyChanged("Damps");
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | [Storable]
|
---|
134 | private DoubleValue muCov;
|
---|
135 | public DoubleValue MuCov {
|
---|
136 | get { return muCov; }
|
---|
137 | set {
|
---|
138 | if (muCov == value) return;
|
---|
139 | muCov = value;
|
---|
140 | OnPropertyChanged("MuCov");
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | [Storable]
|
---|
145 | private DoubleValue cCov;
|
---|
146 | public DoubleValue CCov {
|
---|
147 | get { return cCov; }
|
---|
148 | set {
|
---|
149 | if (cCov == value) return;
|
---|
150 | cCov = value;
|
---|
151 | OnPropertyChanged("CCov");
|
---|
152 | }
|
---|
153 | }
|
---|
154 |
|
---|
155 | [Storable]
|
---|
156 | private DoubleValue cCovSep;
|
---|
157 | public DoubleValue CCovSep {
|
---|
158 | get { return cCovSep; }
|
---|
159 | set {
|
---|
160 | if (cCovSep == value) return;
|
---|
161 | cCovSep = value;
|
---|
162 | OnPropertyChanged("CCovSep");
|
---|
163 | }
|
---|
164 | }
|
---|
165 |
|
---|
166 | [Storable]
|
---|
167 | private DoubleArray pc;
|
---|
168 | public DoubleArray PC {
|
---|
169 | get { return pc; }
|
---|
170 | set {
|
---|
171 | if (pc == value) return;
|
---|
172 | pc = value;
|
---|
173 | OnPropertyChanged("PC");
|
---|
174 | }
|
---|
175 | }
|
---|
176 |
|
---|
177 | [Storable]
|
---|
178 | private DoubleArray ps;
|
---|
179 | public DoubleArray PS {
|
---|
180 | get { return ps; }
|
---|
181 | set {
|
---|
182 | if (ps == value) return;
|
---|
183 | ps = value;
|
---|
184 | OnPropertyChanged("PS");
|
---|
185 | }
|
---|
186 | }
|
---|
187 |
|
---|
188 | [Storable]
|
---|
189 | private DoubleMatrix b;
|
---|
190 | public DoubleMatrix B {
|
---|
191 | get { return b; }
|
---|
192 | set {
|
---|
193 | if (b == value) return;
|
---|
194 | b = value;
|
---|
195 | OnPropertyChanged("B");
|
---|
196 | }
|
---|
197 | }
|
---|
198 |
|
---|
199 | [Storable]
|
---|
200 | private DoubleArray d;
|
---|
201 | public DoubleArray D {
|
---|
202 | get { return d; }
|
---|
203 | set {
|
---|
204 | if (d == value) return;
|
---|
205 | d = value;
|
---|
206 | OnPropertyChanged("D");
|
---|
207 | }
|
---|
208 | }
|
---|
209 |
|
---|
210 | [Storable]
|
---|
211 | private DoubleMatrix c;
|
---|
212 | public DoubleMatrix C {
|
---|
213 | get { return c; }
|
---|
214 | set {
|
---|
215 | if (c == value) return;
|
---|
216 | c = value;
|
---|
217 | OnPropertyChanged("C");
|
---|
218 | }
|
---|
219 | }
|
---|
220 |
|
---|
221 | [Storable]
|
---|
222 | private DoubleArray bDz;
|
---|
223 | public DoubleArray BDz {
|
---|
224 | get { return bDz; }
|
---|
225 | set {
|
---|
226 | if (bDz == value) return;
|
---|
227 | bDz = value;
|
---|
228 | OnPropertyChanged("BDz");
|
---|
229 | }
|
---|
230 | }
|
---|
231 |
|
---|
232 | [Storable]
|
---|
233 | private DoubleValue chiN;
|
---|
234 | public DoubleValue ChiN {
|
---|
235 | get { return chiN; }
|
---|
236 | set {
|
---|
237 | if (chiN == value) return;
|
---|
238 | chiN = value;
|
---|
239 | OnPropertyChanged("ChiN");
|
---|
240 | }
|
---|
241 | }
|
---|
242 |
|
---|
243 | [Storable]
|
---|
244 | private IntValue initialIterations;
|
---|
245 | public IntValue InitialIterations {
|
---|
246 | get { return initialIterations; }
|
---|
247 | set {
|
---|
248 | if (initialIterations == value) return;
|
---|
249 | initialIterations = value;
|
---|
250 | OnPropertyChanged("InitialIterations");
|
---|
251 | }
|
---|
252 | }
|
---|
253 |
|
---|
254 | [Storable]
|
---|
255 | private Queue<double> qualityHistory;
|
---|
256 | public Queue<double> QualityHistory {
|
---|
257 | get { return qualityHistory; }
|
---|
258 | set { qualityHistory = value; }
|
---|
259 | }
|
---|
260 |
|
---|
261 | [Storable]
|
---|
262 | private int qualityHistorySize;
|
---|
263 | public int QualityHistorySize {
|
---|
264 | get { return qualityHistorySize; }
|
---|
265 | set { qualityHistorySize = value; }
|
---|
266 | }
|
---|
267 |
|
---|
268 | [StorableConstructor]
|
---|
269 | private CMAParameters(bool deserializing) : base(deserializing) { }
|
---|
270 | private CMAParameters(CMAParameters original, Cloner cloner)
|
---|
271 | : base(original, cloner) {
|
---|
272 | this.axisRatio = cloner.Clone(original.axisRatio);
|
---|
273 | this.b = cloner.Clone(original.b);
|
---|
274 | this.bDz = cloner.Clone(original.bDz);
|
---|
275 | this.c = cloner.Clone(original.c);
|
---|
276 | this.cCov = cloner.Clone(original.cCov);
|
---|
277 | this.cCovSep = cloner.Clone(original.cCovSep);
|
---|
278 | this.cc = cloner.Clone(original.cc);
|
---|
279 | this.chiN = cloner.Clone(original.chiN);
|
---|
280 | this.cs = cloner.Clone(original.cs);
|
---|
281 | this.d = cloner.Clone(original.d);
|
---|
282 | this.damps = cloner.Clone(original.damps);
|
---|
283 | this.initialIterations = cloner.Clone(original.initialIterations);
|
---|
284 | this.mu = cloner.Clone(original.mu);
|
---|
285 | this.muCov = cloner.Clone(original.muCov);
|
---|
286 | this.muEff = cloner.Clone(original.muEff);
|
---|
287 | this.pc = cloner.Clone(original.pc);
|
---|
288 | this.ps = cloner.Clone(original.ps);
|
---|
289 | this.sigma = cloner.Clone(original.sigma);
|
---|
290 | this.sigmaBounds = cloner.Clone(original.sigmaBounds);
|
---|
291 | this.weights = cloner.Clone(original.weights);
|
---|
292 |
|
---|
293 | this.qualityHistory = new Queue<double>(original.qualityHistory);
|
---|
294 | this.qualityHistorySize = original.qualityHistorySize;
|
---|
295 | }
|
---|
296 | public CMAParameters() { }
|
---|
297 |
|
---|
298 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
299 | return new CMAParameters(this, cloner);
|
---|
300 | }
|
---|
301 |
|
---|
302 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
303 | private void OnPropertyChanged(string name) {
|
---|
304 | var handler = PropertyChanged;
|
---|
305 | if (handler != null) handler(this, new PropertyChangedEventArgs(name));
|
---|
306 | }
|
---|
307 | }
|
---|
308 | }
|
---|