[gnumeric] Solver: nosolve doesn't handle equality constraints.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Solver: nosolve doesn't handle equality constraints.
- Date: Wed, 6 May 2015 13:26:53 +0000 (UTC)
commit 247e929713a48c9ecd77484dbb08b964644195fb
Author: Morten Welinder <terra gnome org>
Date: Wed May 6 09:26:31 2015 -0400
Solver: nosolve doesn't handle equality constraints.
plugins/nlsolve/ChangeLog | 5 +++++
plugins/nlsolve/gnm-nlsolve.c | 17 +++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/plugins/nlsolve/ChangeLog b/plugins/nlsolve/ChangeLog
index 4dc2acc..60ee4fa 100644
--- a/plugins/nlsolve/ChangeLog
+++ b/plugins/nlsolve/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-06 Morten Welinder <terra gnome org>
+
+ * gnm-nlsolve.c (check_program): We really don't handle equality
+ constraints so detect that.
+
2015-04-24 Morten Welinder <terra gnome org>
* gnm-nlsolve.c: Recast in terms of GnmIterSolver.
diff --git a/plugins/nlsolve/gnm-nlsolve.c b/plugins/nlsolve/gnm-nlsolve.c
index 55d55dd..7c31ba8 100644
--- a/plugins/nlsolve/gnm-nlsolve.c
+++ b/plugins/nlsolve/gnm-nlsolve.c
@@ -68,9 +68,15 @@ check_program (const GnmSolverParameters *params, GError **err)
for (l = params->constraints; l; l = l->next) {
GnmSolverConstraint *c = l->data;
- if (c->type == GNM_SOLVER_INTEGER ||
- c->type == GNM_SOLVER_BOOLEAN)
+ switch (c->type) {
+ case GNM_SOLVER_INTEGER:
+ case GNM_SOLVER_BOOLEAN:
goto no_discrete;
+ case GNM_SOLVER_EQ:
+ goto no_equal;
+ default:
+ break;
+ }
}
return TRUE;
@@ -81,6 +87,13 @@ no_discrete:
0,
_("This solver does not handle discrete variables."));
return FALSE;
+
+no_equal:
+ g_set_error (err,
+ go_error_invalid (),
+ 0,
+ _("This solver does not handle equality constraints."));
+ return FALSE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]