[8371] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[17180] | 3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[8371] | 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;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 | using HeuristicLab.Common;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
[16565] | 27 | using HEAL.Attic;
|
---|
[8371] | 28 |
|
---|
[8401] | 29 | namespace HeuristicLab.Algorithms.GradientDescent {
|
---|
[16565] | 30 | [StorableType("2A117076-0311-4F85-A1B9-16F39D5752DE")]
|
---|
[8396] | 31 | [Item("LbfgsState", "Internal state for the limited-memory BFGS optimization algorithm.")]
|
---|
| 32 | public sealed class LbfgsState : Item {
|
---|
[17931] | 33 | private alglib.minlbfgsstate state;
|
---|
| 34 | public alglib.minlbfgsstate State { get { return state; } }
|
---|
[8371] | 35 |
|
---|
| 36 | [StorableConstructor]
|
---|
[17931] | 37 | private LbfgsState(StorableConstructorFlag _) : base(_) { state = new alglib.minlbfgsstate(); }
|
---|
[8396] | 38 | private LbfgsState(LbfgsState original, Cloner cloner)
|
---|
[8371] | 39 | : base(original, cloner) {
|
---|
[17931] | 40 | if (original.state != null)
|
---|
| 41 | this.state = (alglib.minlbfgsstate)original.state.make_copy();
|
---|
[8371] | 42 | }
|
---|
| 43 |
|
---|
[17931] | 44 | public LbfgsState(alglib.minlbfgsstate state)
|
---|
[8371] | 45 | : base() {
|
---|
[17931] | 46 | this.state = (alglib.minlbfgsstate)state.make_copy();
|
---|
[8371] | 47 | }
|
---|
| 48 |
|
---|
| 49 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[8396] | 50 | return new LbfgsState(this, cloner);
|
---|
[8371] | 51 | }
|
---|
| 52 |
|
---|
| 53 | #region persistence
|
---|
| 54 | [Storable]
|
---|
[17931] | 55 | private double[] Autobuf { get { return state.innerobj.autobuf; } set { state.innerobj.autobuf = value; } }
|
---|
[8371] | 56 | [Storable]
|
---|
[17931] | 57 | private double[] D { get { return state.innerobj.d; } set { state.innerobj.d = value; } }
|
---|
[8371] | 58 | [Storable]
|
---|
[17931] | 59 | private double[,] Denseh { get { return state.innerobj.denseh; } set { state.innerobj.denseh = value; } }
|
---|
[8371] | 60 | [Storable]
|
---|
[17931] | 61 | private double[] Diagh { get { return state.innerobj.diagh; } set { state.innerobj.diagh = value; } }
|
---|
[8371] | 62 | [Storable]
|
---|
[17931] | 63 | private double Diffstep { get { return state.innerobj.diffstep; } set { state.innerobj.diffstep = value; } }
|
---|
[8371] | 64 | [Storable]
|
---|
[17931] | 65 | private double Epsf { get { return state.innerobj.epsf; } set { state.innerobj.epsf = value; } }
|
---|
[8371] | 66 | [Storable]
|
---|
[17931] | 67 | private double Epsg { get { return state.innerobj.epsg; } set { state.innerobj.epsg = value; } }
|
---|
[8371] | 68 | [Storable]
|
---|
[17931] | 69 | private double Epsx { get { return state.innerobj.epsx; } set { state.innerobj.epsx = value; } }
|
---|
[8371] | 70 | [Storable]
|
---|
[17931] | 71 | private double F { get { return state.innerobj.f; } set { state.innerobj.f = value; } }
|
---|
[8371] | 72 | [Storable]
|
---|
[17931] | 73 | private double Fbase { get { return state.innerobj.fbase; } set { state.innerobj.fbase = value; } }
|
---|
[8371] | 74 | [Storable]
|
---|
[17931] | 75 | private double Fm1 { get { return state.innerobj.fm1; } set { state.innerobj.fm1 = value; } }
|
---|
[8371] | 76 | [Storable]
|
---|
[17931] | 77 | private double Fm2 { get { return state.innerobj.fm2; } set { state.innerobj.fm2 = value; } }
|
---|
[8371] | 78 | [Storable]
|
---|
[17931] | 79 | private double Fold { get { return state.innerobj.fold; } set { state.innerobj.fold = value; } }
|
---|
[8371] | 80 | [Storable]
|
---|
[17931] | 81 | private double Fp1 { get { return state.innerobj.fp1; } set { state.innerobj.fp1 = value; } }
|
---|
[8371] | 82 | [Storable]
|
---|
[17931] | 83 | private double Fp2 { get { return state.innerobj.fp2; } set { state.innerobj.fp2 = value; } }
|
---|
[8371] | 84 | [Storable]
|
---|
[17931] | 85 | private double[] G { get { return state.innerobj.g; } set { state.innerobj.g = value; } }
|
---|
[8371] | 86 | [Storable]
|
---|
[17931] | 87 | private double Gammak { get { return state.innerobj.gammak; } set { state.innerobj.gammak = value; } }
|
---|
[8371] | 88 | [Storable]
|
---|
[17931] | 89 | private int K { get { return state.innerobj.k; } set { state.innerobj.k = value; } }
|
---|
[8371] | 90 | [Storable]
|
---|
[17931] | 91 | private bool LstateBrackt { get { return state.innerobj.lstate.brackt; } set { state.innerobj.lstate.brackt = value; } }
|
---|
[8371] | 92 | [Storable]
|
---|
[17931] | 93 | private double LstateDg { get { return state.innerobj.lstate.dg; } set { state.innerobj.lstate.dg = value; } }
|
---|
[8371] | 94 | [Storable]
|
---|
[17931] | 95 | private double LstateDginit { get { return state.innerobj.lstate.dginit; } set { state.innerobj.lstate.dginit = value; } }
|
---|
[8371] | 96 | [Storable]
|
---|
[17931] | 97 | private double LstateDgm { get { return state.innerobj.lstate.dgm; } set { state.innerobj.lstate.dgm = value; } }
|
---|
[8371] | 98 | [Storable]
|
---|
[17931] | 99 | private double LstateDgtest { get { return state.innerobj.lstate.dgtest; } set { state.innerobj.lstate.dgtest = value; } }
|
---|
[8371] | 100 | [Storable]
|
---|
[17931] | 101 | private double LstateDgx { get { return state.innerobj.lstate.dgx; } set { state.innerobj.lstate.dgx = value; } }
|
---|
[8371] | 102 | [Storable]
|
---|
[17931] | 103 | private double LstateDgxm { get { return state.innerobj.lstate.dgxm; } set { state.innerobj.lstate.dgxm = value; } }
|
---|
[8371] | 104 | [Storable]
|
---|
[17931] | 105 | private double LstateDgy { get { return state.innerobj.lstate.dgy; } set { state.innerobj.lstate.dgy = value; } }
|
---|
[8371] | 106 | [Storable]
|
---|
[17931] | 107 | private double LstateDgym { get { return state.innerobj.lstate.dgym; } set { state.innerobj.lstate.dgym = value; } }
|
---|
[8371] | 108 | [Storable]
|
---|
[17931] | 109 | private double LstateFinit { get { return state.innerobj.lstate.finit; } set { state.innerobj.lstate.finit = value; } }
|
---|
[8371] | 110 | [Storable]
|
---|
[17931] | 111 | private double LstateFm { get { return state.innerobj.lstate.fm; } set { state.innerobj.lstate.fm = value; } }
|
---|
[8371] | 112 | [Storable]
|
---|
[17931] | 113 | private double LstateFtest1 { get { return state.innerobj.lstate.ftest1; } set { state.innerobj.lstate.ftest1 = value; } }
|
---|
[8371] | 114 | [Storable]
|
---|
[17931] | 115 | private double LstateFx { get { return state.innerobj.lstate.fx; } set { state.innerobj.lstate.fx = value; } }
|
---|
[8371] | 116 | [Storable]
|
---|
[17931] | 117 | private double LstateFxm { get { return state.innerobj.lstate.fxm; } set { state.innerobj.lstate.fxm = value; } }
|
---|
[8371] | 118 | [Storable]
|
---|
[17931] | 119 | private double LstateFy { get { return state.innerobj.lstate.fy; } set { state.innerobj.lstate.fy = value; } }
|
---|
[8371] | 120 | [Storable]
|
---|
[17931] | 121 | private double LstateFym { get { return state.innerobj.lstate.fym; } set { state.innerobj.lstate.fym = value; } }
|
---|
[8371] | 122 | [Storable]
|
---|
[17931] | 123 | private int LstateInfoc { get { return state.innerobj.lstate.infoc; } set { state.innerobj.lstate.infoc = value; } }
|
---|
[8371] | 124 | [Storable]
|
---|
[17931] | 125 | private bool LstateStage1 { get { return state.innerobj.lstate.stage1; } set { state.innerobj.lstate.stage1 = value; } }
|
---|
[8371] | 126 | [Storable]
|
---|
[17931] | 127 | private double LstateStmax { get { return state.innerobj.lstate.stmax; } set { state.innerobj.lstate.stmax = value; } }
|
---|
[8371] | 128 | [Storable]
|
---|
[17931] | 129 | private double LstateStmin { get { return state.innerobj.lstate.stmin; } set { state.innerobj.lstate.stmin = value; } }
|
---|
[8371] | 130 | [Storable]
|
---|
[17931] | 131 | private double LstateStx { get { return state.innerobj.lstate.stx; } set { state.innerobj.lstate.stx = value; } }
|
---|
[8371] | 132 | [Storable]
|
---|
[17931] | 133 | private double LstateSty { get { return state.innerobj.lstate.sty; } set { state.innerobj.lstate.sty = value; } }
|
---|
[8371] | 134 | [Storable]
|
---|
[17931] | 135 | private double LstateWidth { get { return state.innerobj.lstate.width; } set { state.innerobj.lstate.width = value; } }
|
---|
[8371] | 136 | [Storable]
|
---|
[17931] | 137 | private double LstateWidth1 { get { return state.innerobj.lstate.width1; } set { state.innerobj.lstate.width1 = value; } }
|
---|
[8371] | 138 | [Storable]
|
---|
[17931] | 139 | private double LstateXtrapf { get { return state.innerobj.lstate.xtrapf; } set { state.innerobj.lstate.xtrapf = value; } }
|
---|
[8371] | 140 |
|
---|
| 141 | [Storable]
|
---|
[17931] | 142 | private int M { get { return state.innerobj.m; } set { state.innerobj.m = value; } }
|
---|
[8371] | 143 | [Storable]
|
---|
[17931] | 144 | private int MaxIts { get { return state.innerobj.maxits; } set { state.innerobj.maxits = value; } }
|
---|
[8371] | 145 | [Storable]
|
---|
[17931] | 146 | private int Mcstage { get { return state.innerobj.mcstage; } set { state.innerobj.mcstage = value; } }
|
---|
[8371] | 147 | [Storable]
|
---|
[17931] | 148 | private int N { get { return state.innerobj.n; } set { state.innerobj.n = value; } }
|
---|
[8371] | 149 | [Storable]
|
---|
[17931] | 150 | private bool Needf { get { return state.innerobj.needf; } set { state.innerobj.needf = value; } }
|
---|
[8371] | 151 | [Storable]
|
---|
[17931] | 152 | private bool Needfg { get { return state.innerobj.needfg; } set { state.innerobj.needfg = value; } }
|
---|
[8371] | 153 | [Storable]
|
---|
[17931] | 154 | private int Nfev { get { return state.innerobj.nfev; } set { state.innerobj.nfev = value; } }
|
---|
[8371] | 155 | [Storable]
|
---|
[17931] | 156 | private int P { get { return state.innerobj.p; } set { state.innerobj.p = value; } }
|
---|
[8371] | 157 | [Storable]
|
---|
[17931] | 158 | private int Prectype { get { return state.innerobj.prectype; } set { state.innerobj.prectype = value; } }
|
---|
[8371] | 159 | [Storable]
|
---|
[17931] | 160 | private int Q { get { return state.innerobj.q; } set { state.innerobj.q = value; } }
|
---|
[8371] | 161 | [Storable]
|
---|
[17931] | 162 | private int Repiterationscount { get { return state.innerobj.repiterationscount; } set { state.innerobj.repiterationscount = value; } }
|
---|
[8371] | 163 | [Storable]
|
---|
[17931] | 164 | private int Repnfev { get { return state.innerobj.repnfev; } set { state.innerobj.repnfev = value; } }
|
---|
[8371] | 165 | [Storable]
|
---|
[17931] | 166 | private int Repterminationtype { get { return state.innerobj.repterminationtype; } set { state.innerobj.repterminationtype = value; } }
|
---|
[8371] | 167 | [Storable]
|
---|
[17931] | 168 | private double[] Rho { get { return state.innerobj.rho; } set { state.innerobj.rho = value; } }
|
---|
[8371] | 169 | [Storable]
|
---|
[17931] | 170 | private bool[] RstateBa { get { return state.innerobj.rstate.ba; } set { state.innerobj.rstate.ba = value; } }
|
---|
[8371] | 171 | [Storable]
|
---|
| 172 | private IList<Tuple<double, double>> RStateCa {
|
---|
[17931] | 173 | get { return state.innerobj.rstate.ca.Select(c => Tuple.Create(c.x, c.y)).ToList(); }
|
---|
| 174 | set { state.innerobj.rstate.ca = value.Select(t => new alglib.complex(t.Item1, t.Item2)).ToArray(); }
|
---|
[8371] | 175 | }
|
---|
| 176 | [Storable]
|
---|
[17931] | 177 | private int[] RstateIa { get { return state.innerobj.rstate.ia; } set { state.innerobj.rstate.ia = value; } }
|
---|
[8371] | 178 | [Storable]
|
---|
[17931] | 179 | private double[] RstateRa { get { return state.innerobj.rstate.ra; } set { state.innerobj.rstate.ra = value; } }
|
---|
[8371] | 180 | [Storable]
|
---|
[17931] | 181 | private int RstateStage { get { return state.innerobj.rstate.stage; } set { state.innerobj.rstate.stage = value; } }
|
---|
[8371] | 182 | [Storable]
|
---|
[17931] | 183 | private double[] S { get { return state.innerobj.s; } set { state.innerobj.s = value; } }
|
---|
[8371] | 184 | [Storable]
|
---|
[17931] | 185 | private double[,] Sk { get { return state.innerobj.sk; } set { state.innerobj.sk = value; } }
|
---|
[8371] | 186 | [Storable]
|
---|
[17931] | 187 | private double Stp { get { return state.innerobj.stp; } set { state.innerobj.stp = value; } }
|
---|
[8371] | 188 | [Storable]
|
---|
[17931] | 189 | private double Stpmax { get { return state.innerobj.stpmax; } set { state.innerobj.stpmax = value; } }
|
---|
[8371] | 190 | [Storable]
|
---|
[17931] | 191 | private double[] Theta { get { return state.innerobj.theta; } set { state.innerobj.theta = value; } }
|
---|
[8371] | 192 | [Storable]
|
---|
[17931] | 193 | private double Trimthreshold { get { return state.innerobj.trimthreshold; } set { state.innerobj.trimthreshold = value; } }
|
---|
[8371] | 194 | [Storable]
|
---|
[17931] | 195 | private double[] Work { get { return state.innerobj.work; } set { state.innerobj.work = value; } }
|
---|
[8371] | 196 | [Storable]
|
---|
[17931] | 197 | private double[] X { get { return state.innerobj.x; } set { state.innerobj.x = value; } }
|
---|
[8371] | 198 | [Storable]
|
---|
[17931] | 199 | private bool Xrep { get { return state.innerobj.xrep; } set { state.innerobj.xrep = value; } }
|
---|
[8371] | 200 | [Storable]
|
---|
[17931] | 201 | private bool Xupdated { get { return state.innerobj.xupdated; } set { state.innerobj.xupdated = value; } }
|
---|
[8371] | 202 | [Storable]
|
---|
[17931] | 203 | private double[,] Yk { get { return state.innerobj.yk; } set { state.innerobj.yk = value; } }
|
---|
[8371] | 204 | #endregion
|
---|
| 205 | }
|
---|
| 206 | }
|
---|