Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #133, remove_constraints!(opt) doesn't work; chkn() not defined #159

Merged
merged 2 commits into from
Feb 5, 2021
Merged

Fix #133, remove_constraints!(opt) doesn't work; chkn() not defined #159

merged 2 commits into from
Feb 5, 2021

Conversation

sjvrensburg
Copy link
Contributor

Proposed fix for issue #133

Purpose

The purpose of this pull request is to fix issue #133. Currently, remove_constraints!(opt) produces the following error:

UndefVarError: chkn not defined

Stacktrace:
 [1] remove_constraints!(::Opt) at /Users/myname/.julia/packages/NLopt/eqN9a/src/NLopt.jl:457
 [2] top-level scope at In[13]:1

The problem is that there is no function named chkn.

Proposal

It appears that the intention of the missing function is to check for any errors thrown by NLopt. The function chk already does this. Therefore, I have simply redefined remove_constraints! to use chk instead of chkn.

Additional Notes

I have also included a test file, fix133.jl, where I test remove_constraints!(::Opt).

Please note that I'm not a Julia expert and this is my first ever pull request. So, I'm not too sure whether I've done this PR thing correctly. Any constructive feedback will be much appreciated.

@stevengj
Copy link
Collaborator

stevengj commented Feb 5, 2021

LGTM. Nice PR!

I think chkn was from the older error handling method in NLopt, and this call was somehow overlooked when we updated to the new mechanism that requires us to pass the Opt object in order to get an error message.

@stevengj stevengj merged commit 28b7f83 into jump-dev:master Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants