-
Notifications
You must be signed in to change notification settings - Fork 21
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
docstrings changed for solve to match opty #301
base: master
Are you sure you want to change the base?
Changes from 5 commits
fa77376
bf3551d
c92117c
790d9c0
673b9b0
76c6b3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -197,6 +197,54 @@ def __init__(self, obj, obj_grad, equations_of_motion, state_symbols, | |||||
|
||||||
self.obj_value = [] | ||||||
|
||||||
# this is added only to correct the docstring, which is a bit different with | ||||||
# opty compared to cyipopt. | ||||||
def solve(self, free, lagrange=[], zl=[], zu=[]): | ||||||
"""Returns the optimal solution and an info dictionary. | ||||||
|
||||||
Solves the posed optimization problem starting at point x. | ||||||
|
||||||
Parameters | ||||||
---------- | ||||||
x : array-like, shape(n*N + q*N + r + s, ) | ||||||
Initial guess. | ||||||
|
||||||
lagrange : array-like, shape(n*(N-1) + o, ), optional (default=[]) | ||||||
Initial values for the constraint multipliers (only if warm start option is chosen). | ||||||
|
||||||
zl : array-like, shape(n*N + q*N + r + s, ), optional (default=[]) | ||||||
Initial values for the multipliers for lower variable bounds (only if warm start option is chosen). | ||||||
|
||||||
zu : array-like, shape(n*N + q*N + r + s, ), optional (default=[]) | ||||||
Initial values for the multipliers for upper variable bounds (only if warm start option is chosen). | ||||||
|
||||||
Returns | ||||||
------- | ||||||
x : :py:class:`numpy.ndarray`, shape `(n*N + q*N + r + s, )` | ||||||
Optimal solution. | ||||||
info: :py:class:`dict` with the following entries | ||||||
|
||||||
``x``: :py:class:`numpy.ndarray`, shape `(n*N + q*N + r + s, )` | ||||||
optimal solution | ||||||
``g``: :py:class:`numpy.ndarray`, shape `(n*(N-1) + o, )` | ||||||
constraints at the optimal solution | ||||||
``obj_val``: :py:class:`float` | ||||||
objective value at optimal solution | ||||||
``mult_g``: :py:class:`numpy.ndarray`, shape `(n*(N-1) + o, )` | ||||||
final values of the constraint multipliers | ||||||
``mult_x_L``: :py:class:`numpy.ndarray`, shape `(n*N + q*N + r + s, )` | ||||||
bound multipliers at the solution | ||||||
``mult_x_U``: :py:class:`numpy.ndarray`, shape `(n*N + q*N + r + s, )` | ||||||
bound multipliers at the solution | ||||||
``status``: :py:class:`int` | ||||||
gives the status of the algorithm | ||||||
``status_msg``: :py:class:`str` | ||||||
gives the status of the algorithm as a message | ||||||
|
||||||
""" | ||||||
|
||||||
return super().solve(free, lagrange=[], zl=[], zu=[]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Needs that changed, otherwise the arguments that the user passes in will never reach this method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shows my weakness in python - after so many years! :-( |
||||||
|
||||||
def _generate_bound_arrays(self): | ||||||
lb = -self.INF * np.ones(self.num_free) | ||||||
ub = self.INF * np.ones(self.num_free) | ||||||
|
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.
These two lines are not need. If is common to overwrite methods in sub classes for this reason and it needs no explanation.