From 253b66d3c7206b04847758d8c2fa8c37a8f62ada Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Wed, 2 Jun 2021 15:38:37 +0800 Subject: [PATCH] update sample3 --- src/sample/sample3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sample/sample3.cpp b/src/sample/sample3.cpp index d61fc42..8b61149 100644 --- a/src/sample/sample3.cpp +++ b/src/sample/sample3.cpp @@ -70,7 +70,7 @@ int TEST_FUNC::Progress(const lbfgsfloatval_t *x, const lbfgsfloatval_t *g, cons const lbfgsfloatval_t xnorm, const lbfgsfloatval_t gnorm, const lbfgsfloatval_t step, const lbfgs_parameter_t param, int n, int k, int ls) { - clog << "iteration times: " << k << " fx = " << fx << " gnorm/xnorm = " << gnorm/xnorm << endl; + clog << "iteration times: " << k << " fx = " << fx << " gnorm/xnorm = " << gnorm/(xnorm>1.0?xnorm:1.0) << endl; clog << x[0] << " " << x[1] << " " << x[2] << endl; if (fx < 1e-10) return 1; //这里我们设置一个方程组的整体目标函数值作为终止条件 因为此方程组在0值处梯度不为0 无法使用梯度条件 @@ -83,6 +83,7 @@ int TEST_FUNC::Routine() lbfgs_parameter_t self_para; lbfgs_parameter_init(&self_para); + self_para.past = 2; //self_para.min_step = 1e-30; //self_para.max_linesearch = 40; //self_para.linesearch = LBFGS_LINESEARCH_BACKTRACKING_WOLFE;