-
Notifications
You must be signed in to change notification settings - Fork 56
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
Pass args and kwargs to Hessian of objective function #176
Conversation
cyipopt/scipy_interface.py
Outdated
raise NotImplementedError( | ||
'jac has to be bool or a function (got {!r})'.format(type(jac)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As CyIpopt is now Python>=3.7 can we please make the f-strings instead of using .format()
?
cyipopt/scipy_interface.py
Outdated
raise NotImplementedError( | ||
'jac of constraints has to be bool or a function (got {!r})'.format(type(con_jac)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f-string please.
cyipopt/scipy_interface.py
Outdated
@@ -270,6 +274,7 @@ def get_constraint_dimensions(constraints, x0): | |||
|
|||
|
|||
def get_constraint_bounds(constraints, x0, INF=1e19): | |||
TYPE_EQ, TYPE_INEQ = 'eq', 'ineq' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this use of tuple unpacking is clever, I personally don't think it's the clearest to read. Can we please split to two assignments over two lines.
cyipopt/scipy_interface.py
Outdated
msg = "Invalid constraint type: {!r}. Valid types are {}." | ||
raise ValueError( | ||
msg.format(con['type'], (TYPE_EQ, TYPE_INEQ)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f-string please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition, thank you. Especially appreciate the addition of tests for this. To try and keep the code as tidy as possible, please can we try to adhere to PEP8 formatting, particularly separation of top level function and class definitions by two blank lines.
Currently blocked by #177. |
Can you merge in master here so the tests run in CI? |
args
andkwargs
are passed to the Hessian of the objective function. This should fix Objective function not passed extra arguments when Hessian is provided #175.args
andkwargs
are passed to the objective, Jacobian and Hessian.raise ImportError()
without amsg
and hopefully clarified some error messages.