Skip to content

Fix overflow dual annealing#364

Merged
stijnh merged 2 commits intomasterfrom
fix_overflow_dual_annealing
Mar 17, 2026
Merged

Fix overflow dual annealing#364
stijnh merged 2 commits intomasterfrom
fix_overflow_dual_annealing

Conversation

@benvanwerkhoven
Copy link
Collaborator

Fixes the warning as mentioned in #362.

Also solves a possible division by zero in simulated annealing.

@benvanwerkhoven benvanwerkhoven requested a review from stijnh March 10, 2026 09:07
@sonarqubecloud
Copy link

Copy link
Member

@stijnh stijnh left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@stijnh stijnh merged commit 94d0496 into master Mar 17, 2026
4 checks passed
@stijnh
Copy link
Member

stijnh commented Mar 17, 2026

The line (np.abs(old_cost) if old_cost != 0.0 else 1e-20) could also be max(np.abs(old_cost), 1e-20) to make sure it also works if 0 < np.abs(old_cost) < 1e-20

@benvanwerkhoven
Copy link
Collaborator Author

That line is only to avoid a division by zero, so the 1e-20 is only used when old_cost is exactly 0.0. If the tuning objective is meaningfully trying to optimize tiny values and 1e-20 would be 'higher' than the real objective values this could indeed lead to strange decision making. However, having actual objective values in that range with Kernel Tuner seems unlikely and it would still be extremely rare as this is only triggered when the returned cost is exactly 0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants