1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 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 System.Collections.Generic;
|
---|
23 | using System.Linq;
|
---|
24 | using HeuristicLab.Common;
|
---|
25 | using HeuristicLab.Core;
|
---|
26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Algorithms.CMAEvolutionStrategy {
|
---|
29 | [Item("CMAParameters", "CMA-ES controls many strategy parameters that guide the search and which are combined in this class.")]
|
---|
30 | [StorableType("C309731D-87B8-44DB-A994-53E39489F0FD")]
|
---|
31 | public sealed class CMAParameters : Item {
|
---|
32 |
|
---|
33 | [Storable(Name = "axisRatio")]
|
---|
34 | public double AxisRatio { get; set; }
|
---|
35 | [Storable(Name = "sigma")]
|
---|
36 | public double Sigma { get; set; }
|
---|
37 | [Storable(Name = "sigmaBounds")]
|
---|
38 | public double[,] SigmaBounds { get; set; }
|
---|
39 | [Storable(Name = "mu")]
|
---|
40 | public int Mu { get; set; }
|
---|
41 | [Storable(Name = "weights")]
|
---|
42 | public double[] Weights { get; set; }
|
---|
43 | [Storable(Name = "muEff")]
|
---|
44 | public double MuEff { get; set; }
|
---|
45 | [Storable(Name = "cc")]
|
---|
46 | public double CC { get; set; }
|
---|
47 | [Storable(Name = "cs")]
|
---|
48 | public double CS { get; set; }
|
---|
49 | [Storable(Name = "damps")]
|
---|
50 | public double Damps { get; set; }
|
---|
51 | [Storable(Name = "muCov")]
|
---|
52 | public double MuCov { get; set; }
|
---|
53 | [Storable(Name = "cCov")]
|
---|
54 | public double CCov { get; set; }
|
---|
55 | [Storable(Name = "cCovSep")]
|
---|
56 | public double CCovSep { get; set; }
|
---|
57 | [Storable(Name = "pc")]
|
---|
58 | public double[] PC { get; set; }
|
---|
59 | [Storable(Name = "ps")]
|
---|
60 | public double[] PS { get; set; }
|
---|
61 | [Storable(Name = "b")]
|
---|
62 | public double[,] B { get; set; }
|
---|
63 | [Storable(Name = "d")]
|
---|
64 | public double[] D { get; set; }
|
---|
65 | [Storable(Name = "c")]
|
---|
66 | public double[,] C { get; set; }
|
---|
67 | [Storable(Name = "bDz")]
|
---|
68 | public double[] BDz { get; set; }
|
---|
69 | [Storable(Name = "chiN")]
|
---|
70 | public double ChiN { get; set; }
|
---|
71 | [Storable(Name = "initialIterations")]
|
---|
72 | public int InitialIterations { get; set; }
|
---|
73 | [Storable(Name = "qualityHistory")]
|
---|
74 | private IEnumerable<double> StorableQualityHistory {
|
---|
75 | get { return QualityHistory ?? Enumerable.Empty<double>(); }
|
---|
76 | set { if (value != null) QualityHistory = new Queue<double>(value); }
|
---|
77 | }
|
---|
78 | public Queue<double> QualityHistory { get; set; }
|
---|
79 | [Storable(Name = "qualityHistorySize")]
|
---|
80 | public int QualityHistorySize { get; set; }
|
---|
81 |
|
---|
82 | [StorableConstructor]
|
---|
83 | private CMAParameters(bool deserializing) : base(deserializing) { }
|
---|
84 | private CMAParameters(CMAParameters original, Cloner cloner)
|
---|
85 | : base(original, cloner) {
|
---|
86 | this.AxisRatio = original.AxisRatio;
|
---|
87 | if (original.B != null) this.B = (double[,])original.B.Clone();
|
---|
88 | if (original.BDz != null) this.BDz = (double[])original.BDz.Clone();
|
---|
89 | if (original.C != null) this.C = (double[,])original.C.Clone();
|
---|
90 | this.CCov = original.CCov;
|
---|
91 | this.CCovSep = original.CCovSep;
|
---|
92 | this.CC = original.CC;
|
---|
93 | this.ChiN = original.ChiN;
|
---|
94 | this.CS = original.CS;
|
---|
95 | if (original.D != null) this.D = (double[])original.D.Clone();
|
---|
96 | this.Damps = original.Damps;
|
---|
97 | this.InitialIterations = original.InitialIterations;
|
---|
98 | this.Mu = original.Mu;
|
---|
99 | this.MuCov = original.MuCov;
|
---|
100 | this.MuEff = original.MuEff;
|
---|
101 | if (original.PC != null) this.PC = (double[])original.PC.Clone();
|
---|
102 | if (original.PS != null) this.PS = (double[])original.PS.Clone();
|
---|
103 | this.Sigma = original.Sigma;
|
---|
104 | if (original.SigmaBounds != null) this.SigmaBounds = (double[,])original.SigmaBounds.Clone();
|
---|
105 | if (original.Weights != null) this.Weights = (double[])original.Weights.Clone();
|
---|
106 |
|
---|
107 | if (original.QualityHistory != null) this.QualityHistory = new Queue<double>(original.QualityHistory);
|
---|
108 | this.QualityHistorySize = original.QualityHistorySize;
|
---|
109 | }
|
---|
110 | public CMAParameters() { }
|
---|
111 |
|
---|
112 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
113 | return new CMAParameters(this, cloner);
|
---|
114 | }
|
---|
115 | }
|
---|
116 | }
|
---|