[gnumeric] nlsolve: minor improvement to tentative moves.



commit cb9417aefbf70daa5d746793c443277007318dda
Author: Morten Welinder <terra gnome org>
Date:   Tue Jun 1 21:22:02 2010 -0400

    nlsolve: minor improvement to tentative moves.

 plugins/nlsolve/ChangeLog     |    5 +++++
 plugins/nlsolve/gnm-nlsolve.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/plugins/nlsolve/ChangeLog b/plugins/nlsolve/ChangeLog
index cc093b6..14d2b31 100644
--- a/plugins/nlsolve/ChangeLog
+++ b/plugins/nlsolve/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-01  Morten Welinder  <terra gnome org>
+
+	* gnm-nlsolve.c (rosenbrock_iter): Only allow first newton
+	improvement step to increase objective value.
+
 2010-05-31  Morten Welinder  <terra gnome org>
 
 	* gnm-nlsolve.c (rosenbrock_iter): Add safety against
diff --git a/plugins/nlsolve/gnm-nlsolve.c b/plugins/nlsolve/gnm-nlsolve.c
index 32518f0..cad015d 100644
--- a/plugins/nlsolve/gnm-nlsolve.c
+++ b/plugins/nlsolve/gnm-nlsolve.c
@@ -327,7 +327,8 @@ newton_improve (GnmNlsolve *nl, gnm_float *xs, gnm_float *y, gnm_float ymax)
 			y2 = get_value (nl);
 			if (nl->debug) {
 				print_vector ("xs2", xs2, n);
-				g_printerr ("YYY %.15g\n", y2);
+				g_printerr ("Obj value %.15" GNM_FORMAT_g "\n",
+					    y2);
 			}
 
 			if (y2 < ymax) {
@@ -560,6 +561,8 @@ rosenbrock_iter (GnmNlsolve *nl)
 			for (i = 0; i < 4; i++) {
 				gnm_float ymax = yk +
 					gnm_abs (yk) * (0.10 / (i + 1));
+				if (i > 0)
+					ymax = MIN (ymax, nl->yk);
 				if (!newton_improve (nl, nl->xk, &nl->yk, ymax))
 					break;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]