public override IOperation Apply() { double[] initialPoint = Point.ToArray(); int n = initialPoint.Length; alglib.minlbfgs.minlbfgsstate state = new alglib.minlbfgs.minlbfgsstate(); if (ApproximateGradients.Value) { alglib.minlbfgs.minlbfgscreatef(n, Math.Min(n, 10), initialPoint, 1E-5, state); } else { alglib.minlbfgs.minlbfgscreate(n, Math.Min(n, 10), initialPoint, state); } alglib.minlbfgs.minlbfgssetcond(state, 0.0, 0, 0, Iterations.Value); alglib.minlbfgs.minlbfgssetxrep(state, true); if (GradientStepSizeParameter.ActualValue != null && GradientStepSizeParameter.ActualValue.Value > 0) { alglib.minlbfgs.minlbfgssetgradientcheck(state, GradientStepSizeParameter.ActualValue.Value); } PointParameter.ActualValue = new RealVector(initialPoint); StateParameter.ActualValue = new LbfgsState(state); return(base.Apply()); }
private LbfgsState(LbfgsState original, Cloner cloner) : base(original, cloner) { this.state = new alglib.minlbfgs.minlbfgsstate(); this.state.autobuf = CopyArray(original.state.autobuf); this.state.d = CopyArray(original.state.d); this.state.denseh = CopyArray(original.state.denseh); this.state.diagh = CopyArray(original.state.diagh); this.state.diffstep = original.state.diffstep; this.state.epsf = original.state.epsf; this.state.epsg = original.state.epsg; this.state.epsx = original.state.epsx; this.state.f = original.state.f; this.state.fbase = original.state.fbase; this.state.fm1 = original.state.fm1; this.state.fm2 = original.state.fm2; this.state.fold = original.state.fold; this.state.fp1 = original.state.fp1; this.state.fp2 = original.state.fp1; this.state.g = CopyArray(original.state.g); this.state.gammak = original.state.gammak; this.state.k = original.state.k; this.state.lstate.brackt = original.state.lstate.brackt; this.state.lstate.dg = original.state.lstate.dg; this.state.lstate.dginit = original.state.lstate.dginit; this.state.lstate.dgm = original.state.lstate.dgm; this.state.lstate.dgtest = original.state.lstate.dgtest; this.state.lstate.dgx = original.state.lstate.dgx; this.state.lstate.dgxm = original.state.lstate.dgxm; this.state.lstate.dgy = original.state.lstate.dgy; this.state.lstate.dgym = original.state.lstate.dgym; this.state.lstate.finit = original.state.lstate.finit; this.state.lstate.fm = original.state.lstate.fm; this.state.lstate.ftest1 = original.state.lstate.ftest1; this.state.lstate.fx = original.state.lstate.fx; this.state.lstate.fxm = original.state.lstate.fxm; this.state.lstate.fy = original.state.lstate.fy; this.state.lstate.fym = original.state.lstate.fym; this.state.lstate.infoc = original.state.lstate.infoc; this.state.lstate.stage1 = original.state.lstate.stage1; this.state.lstate.stmax = original.state.lstate.stmax; this.state.lstate.stmin = original.state.lstate.stmin; this.state.lstate.stx = original.state.lstate.stx; this.state.lstate.sty = original.state.lstate.sty; this.state.lstate.width = original.state.lstate.width; this.state.lstate.width1 = original.state.lstate.width1; this.state.lstate.xtrapf = original.state.lstate.xtrapf; this.state.m = original.state.m; this.state.maxits = original.state.maxits; this.state.mcstage = original.state.mcstage; this.state.n = original.state.n; this.state.needf = original.state.needf; this.state.needfg = original.state.needfg; this.state.nfev = original.state.nfev; this.state.p = original.state.p; this.state.prectype = original.state.prectype; this.state.q = original.state.q; this.state.repiterationscount = original.state.repiterationscount; this.state.repnfev = original.state.repnfev; this.state.repterminationtype = original.state.repterminationtype; this.state.rho = CopyArray(original.state.rho); this.state.rstate.ba = CopyArray(original.state.rstate.ba); this.state.rstate.ca = CopyArray(original.state.rstate.ca); this.state.rstate.ia = CopyArray(original.state.rstate.ia); this.state.rstate.ra = CopyArray(original.state.rstate.ra); this.state.rstate.stage = original.state.rstate.stage; this.state.s = CopyArray(original.state.s); this.state.sk = CopyArray(original.state.sk); this.state.stp = original.state.stp; this.state.stpmax = original.state.stpmax; this.state.theta = CopyArray(original.state.theta); this.state.trimthreshold = original.state.trimthreshold; this.state.work = CopyArray(original.state.work); this.state.x = CopyArray(original.state.x); this.state.xrep = original.state.xrep; this.state.xupdated = original.state.xupdated; this.state.yk = CopyArray(original.state.yk); }
private LbfgsState(bool deserializing) : base(deserializing) { state = new alglib.minlbfgs.minlbfgsstate(); }
public LbfgsState(alglib.minlbfgs.minlbfgsstate state) : base() { this.state = state; }
public override IOperation Apply() { double[] initialPoint = Point.ToArray(); int n = initialPoint.Length; alglib.minlbfgs.minlbfgsstate state = new alglib.minlbfgs.minlbfgsstate(); if (ApproximateGradients.Value) { alglib.minlbfgs.minlbfgscreatef(n, Math.Min(n, 10), initialPoint, 1E-5, state); } else { alglib.minlbfgs.minlbfgscreate(n, Math.Min(n, 10), initialPoint, state); } alglib.minlbfgs.minlbfgssetcond(state, 0.0, 0, 0, Iterations.Value); alglib.minlbfgs.minlbfgssetxrep(state, true); if (GradientStepSizeParameter.ActualValue != null && GradientStepSizeParameter.ActualValue.Value > 0) alglib.minlbfgs.minlbfgssetgradientcheck(state, GradientStepSizeParameter.ActualValue.Value); PointParameter.ActualValue = new RealVector(initialPoint); StateParameter.ActualValue = new LbfgsState(state); return base.Apply(); }
private LbfgsState(StorableConstructorFlag _) : base(_) { state = new alglib.minlbfgs.minlbfgsstate(); }