Skip to content

Commit

Permalink
slsqp: check ptot>n, not p>n (proper fix for stevengj#592)
Browse files Browse the repository at this point in the history
src/algs/slsqp/slsqp.c (src/algs/slsqp/slsqp.c): Fix the check for more
equality constraints than variables (introduced by PR stevengj#593 to fix stevengj#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).
  • Loading branch information
kkofler committed Feb 24, 2025
1 parent 1af6c51 commit 2715a21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/algs/slsqp/slsqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2715a21

Please sign in to comment.