From df74bfb15fca01e422e2d63c41173f2d83eb509e Mon Sep 17 00:00:00 2001 From: Aymeric Stamm Date: Tue, 18 Jun 2024 13:28:36 +0200 Subject: [PATCH] Add propagation of extra arguments to inequality constraints when using deprecated behavior. Closes #159. --- R/auglag.R | 2 +- R/ccsaq.R | 2 +- R/cobyla.R | 2 +- R/global.R | 2 +- R/mma.R | 2 +- R/slsqp.R | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/auglag.R b/R/auglag.R index b0ace12..2ffcf69 100644 --- a/R/auglag.R +++ b/R/auglag.R @@ -196,7 +196,7 @@ auglag <- function(x0, fn, gr = NULL, lower = NULL, upper = NULL, hin = NULL, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } } if (!dfree) { diff --git a/R/ccsaq.R b/R/ccsaq.R index 454ab98..faa2342 100644 --- a/R/ccsaq.R +++ b/R/ccsaq.R @@ -133,7 +133,7 @@ ccsaq <- function(x0, fn, gr = NULL, lower = NULL, upper = NULL, hin = NULL, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } if (is.null(hinjac)) { hinjac <- function(x) nl.jacobian(x, hin) diff --git a/R/cobyla.R b/R/cobyla.R index e04a59e..8425cf5 100644 --- a/R/cobyla.R +++ b/R/cobyla.R @@ -109,7 +109,7 @@ cobyla <- function(x0, fn, lower = NULL, upper = NULL, hin = NULL, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } } diff --git a/R/global.R b/R/global.R index e3371f7..80b752b 100644 --- a/R/global.R +++ b/R/global.R @@ -201,7 +201,7 @@ isres <- function(x0, fn, lower, upper, hin = NULL, heq = NULL, maxeval = 10000, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } } diff --git a/R/mma.R b/R/mma.R index 96401cf..f363f70 100644 --- a/R/mma.R +++ b/R/mma.R @@ -142,7 +142,7 @@ mma <- function(x0, fn, gr = NULL, lower = NULL, upper = NULL, hin = NULL, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } if (is.null(hinjac)) { hinjac <- function(x) nl.jacobian(x, hin) diff --git a/R/slsqp.R b/R/slsqp.R index 60027f7..1281e46 100644 --- a/R/slsqp.R +++ b/R/slsqp.R @@ -127,7 +127,7 @@ slsqp <- function(x0, fn, gr = NULL, lower = NULL, upper = NULL, hin = NULL, "restate the inequality to be <=0. The ability to use the old ", "behavior will be removed in a future release.") .hin <- match.fun(hin) - hin <- function(x) -.hin(x) # change hin >= 0 to hin <= 0 ! + hin <- function(x) -.hin(x, ...) # change hin >= 0 to hin <= 0 ! } if (is.null(hinjac)) {