Skip to content

Bug 17703 - constrOptim() fails for a well-specified problem #92

Open
@hturner

Description

@hturner

Bug 17703 documents a case where constrOptim() throws an error for a well-spedified constrained optimization problem. The error is thrown because the objective function becomes non-finite due to imprecision caused by floating-point arithmetic. In particular, the error is triggered by a check for negative values in object gi on L32 (prior to a log(gi) computation that would produce NaN for negative values).

@mmaechler indicates that a patch would be welcome along the following lines:

  • Avoid false precision by removing noise from gi before checking, e.g. with signif(gi, digits), where digits is a new argument
  • Update the corresponding help file constrOptim.Rd

Note: bug report specifies this as an issue in R-3.6.2, I have confirmed this is still present in R-devel (2025/05/15, r88203).

Metadata

Metadata

Labels

AccuracyIssues related to accuracyRR 2025Issues reserved for R Dev Day @ Rencontres R 2025needs patchImplement the agreed fix and prepare a patch for review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions