From f61115adb7398c102299d211d99f902e3e3bacca Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Tue, 25 Feb 2025 08:09:25 +0100 Subject: [PATCH] slsqp: check ptot>n, not p>n src/algs/slsqp/slsqp.c (src/algs/slsqp/slsqp.c): Fix the check for more equality constraints than variables (introduced by PR #593 to fix #592) so that vector constraints (mconstraints) are correctly counted: the count to consider here is ptot (the total number of scalar equality constraints), not p (the number of equality constraints that may be vector constraints). --- src/algs/slsqp/slsqp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algs/slsqp/slsqp.c b/src/algs/slsqp/slsqp.c index e6360624..2d9763eb 100644 --- a/src/algs/slsqp/slsqp.c +++ b/src/algs/slsqp/slsqp.c @@ -2459,7 +2459,7 @@ nlopt_result nlopt_slsqp(unsigned n, nlopt_func f, void *f_data, unsigned max_cdim; int want_grad = 1; - if (p > n) { + if (ptot > n) { nlopt_stop_msg(stop, "slsqp: more equality constraints than variables"); return NLOPT_INVALID_ARGS; }