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

Optimizer hotfix #673

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
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
7 changes: 7 additions & 0 deletions fastlane_bot/tools/optimizer/margpoptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ def dtknfromp_f(p, *, islog10=True, asdct=False, quiet=False):
p = np.exp(plog10 * np.log(10))
criterium = np.linalg.norm(dplog10)

# this fix could cut down on some of the logging noise by raising a ConvergenceError early
if max(p) > 1e50:
raise self.ConvergenceError(f"price vector component exceeds maximum price [p={p}]")
if min(p) < 1e-50:
raise self.ConvergenceError(f"price vector component below minimum price [p={p}]")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'overflow' warnings are emitted right before you raise this exception, at:

p = np.exp(plog10 * np.log(10))

Consider raising it prior to that line, by applying a similar check on plog10 (since p is not yet available).



# ...print out some info if requested...
if P("verbose"):
print(f"\n[margp_optimizer] ========== cycle {i} =======>>>")
Expand Down
Loading