-
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
Open
Peter230655
wants to merge
6
commits into
csu-hmc:master
Choose a base branch
from
Peter230655:correction-solve-docu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fa77376
docstrings changed for solve to match opty
Peter230655 bf3551d
tried to correct the error which made it fail a test
Peter230655 c92117c
next try to solve the error
Peter230655 790d9c0
copied from cyipopt code and only changed a few things relevant for opty
Peter230655 673b9b0
corrected signature
Peter230655 76c6b3a
corrected errors in signature, removed unnecessary explanations
Peter230655 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): | ||
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. This signature does not match cyipopt's. |
||
"""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) | ||
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. This line is not correct because it will not handle the optional keyword arguments. |
||
|
||
def _generate_bound_arrays(self): | ||
lb = -self.INF * np.ones(self.num_free) | ||
ub = self.INF * np.ones(self.num_free) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.