Skip to content

Add inverted and shifted hartmann benchmark#674

Open
Hrovatin wants to merge 22 commits intomainfrom
benchmark/shifted
Open

Add inverted and shifted hartmann benchmark#674
Hrovatin wants to merge 22 commits intomainfrom
benchmark/shifted

Conversation

@Hrovatin
Copy link
Copy Markdown
Collaborator

@Hrovatin Hrovatin commented Oct 22, 2025

Add two new TL benchmarks:

  • Inverted hartmann
  • Hartmann shifted in one dimension

@kalama-ai

Copy link
Copy Markdown
Collaborator

@kalama-ai kalama-ai left a comment

Choose a reason for hiding this comment

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

Thanks, @Hrovatin for implementing the new benchmarks. Except some clean up, I am fine with the implementation.

@Hrovatin Hrovatin requested a review from kalama-ai October 22, 2025 14:58
@AVHopp AVHopp requested a review from Copilot October 23, 2025 14:33

This comment was marked as resolved.

Copy link
Copy Markdown
Collaborator

@AVHopp AVHopp left a comment

Choose a reason for hiding this comment

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

Like the way this is going! Have some more ideas for further simplification

@Hrovatin Hrovatin requested a review from AVHopp November 6, 2025 13:57
Copy link
Copy Markdown
Collaborator

@AVHopp AVHopp left a comment

Choose a reason for hiding this comment

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

Some comments related to parts of the design that I still do not fully agree with resp. understand

@Hrovatin Hrovatin requested review from AVHopp and Scienfitz January 21, 2026 11:08
@Scienfitz
Copy link
Copy Markdown
Collaborator

@Hrovatin any movement in this PR or should we close it?

@Hrovatin
Copy link
Copy Markdown
Collaborator Author

@Scienfitz still on my todo list to add your last two comments

@Hrovatin Hrovatin requested a review from Scienfitz March 31, 2026 13:21
Hrovatin and others added 7 commits March 31, 2026 19:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updated the docstring to clarify that the callable now shifts both dimensions and bounds for the Hartmann function.
@Hrovatin Hrovatin force-pushed the benchmark/shifted branch from 9efb03a to 2547819 Compare March 31, 2026 17:49
Copy link
Copy Markdown
Collaborator

@Scienfitz Scienfitz left a comment

Choose a reason for hiding this comment

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

lgtm, last comments but otherwise ready for merge

raise ValueError("Shift shape does not match used dimensions.")
self.shift = shift if shift is not None else [0.0] * bounds_array.shape[0]

# Shift the bounds
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Shift the bounds
# Extend the bounds

"shift" would only be accurate if you always change lower and upper end by same amount

Actually, this bounds = expression below still looks overly complex to me, the expression reads terribly. Naively one would shift both upper and lower bound by the same amount, that doesn't work?

Assuming there is a reason for that, I can still think of this:

bounds = [
    (low - abs(s), high + abs(s))
    for (low, high), s in zip(bounds_array, self.shift)
]

(or similar)
which is not shifting but widening the bounds (should also work for passing the validation and is a more readable expression).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I needed to adapt it as follows

# Note: We can not only shift the upper and lower bounds as that leads to the
# optimal value (``_optimizer``) being excluded from bounds. As this is
# hard-coded in the Hartmann class init, we can not override it before it is
# evaluated.
shifted_bounds = bounds + np.array(self.shift)[:, None]
bounds_extended = list(
    map(
        tuple,
        np.stack(
            [
                np.minimum(bounds[:, 0], shifted_bounds[:, 0]),
                np.maximum(bounds[:, 1], shifted_bounds[:, 1]),
            ],
            axis=1,
        ),
    )
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does the benchmark work when running locally?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For me it did with python -m benchmarks ...

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.

6 participants