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

IPOPT duplicated history handling #252

Merged
merged 19 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyoptsparse/postprocessing/OptView_baseclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def OptimizationHistory(self):
# Raise warning for IPOPT's duplicated history
if db["metadata"]["optimizer"] == "IPOPT" and "iter" not in db["0"].keys():
pyOptSparseWarning(
"The optimization history of IPOPT has duplicated entries at every iteration, and the OptView plot is not correct. \
Install the latest version of pyOptSparse for a fix."
"The optimization history file has duplicated entries at every iteration, and the OptView plot is not correct. \
kanekosh marked this conversation as resolved.
Show resolved Hide resolved
Re-run the optimization with a current version of pyOptSparse to generate a correct history file."
)

# Save information from the history file for the funcs.
Expand Down
5 changes: 4 additions & 1 deletion pyoptsparse/pyOpt_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ def getValues(self, names=None, callCounters=None, major=True, scale=False, stac

# Raise warning for IPOPT's duplicated history
if self.db["metadata"]["optimizer"] == "IPOPT" and "iter" not in self.db["0"].keys():
kanekosh marked this conversation as resolved.
Show resolved Hide resolved
pyOptSparseWarning("The optimization history of IPOPT has duplicated entries at every iteration.")
pyOptSparseWarning(
"The optimization history of IPOPT has duplicated entries at every iteration. \
Fix the history manually, or re-run the optimization with a current version of pyOptSparse to generate a correct history file."
)
return data

def _checkIPOPTDuplicateHistory(self, val):
Expand Down
1 change: 1 addition & 0 deletions pyoptsparse/pyOpt_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(
checkDefaultOptions=checkDefaultOptions,
caseSensitiveOptions=caseSensitiveOptions,
)
# callCounter will be incremented after the function calls, iterCounters will be incremented before the calls.
self.callCounter = 0 # counts all function calls (fobj, fcon, gobj, gcon)
self.iterCounter = -1 # counts iteration(new x point)
kanekosh marked this conversation as resolved.
Show resolved Hide resolved
self.sens: Union[None, Callable, Gradient] = None
Expand Down