Skip to content

fix: correct Forrester benchmark in quick-start examples - #69

Open
arunimshukla wants to merge 1 commit into
blackrock:mainfrom
arunimshukla:fix-forrester-documentation
Open

arunimshukla wants to merge 1 commit into
blackrock:mainfrom
arunimshukla:fix-forrester-documentation

Conversation

@arunimshukla

Copy link
Copy Markdown

Summary

Correct the Forrester function in the README quick start and getting-started guide so both examples match the repository’s existing benchmark implementation.

Problem

Both documented examples define term = 6 * x - 2, then calculate:

term ** 2 * math.sin(term / 2)

However, hola-py/benchmarks/functions/single_objective.py implements the Forrester benchmark as:

(6 * x - 2) ** 2 * math.sin(12 * x - 4)

The documented sine argument is therefore 3*x - 1 instead of 12*x - 4. Users copying these examples optimise a different function and cannot reproduce the stated benchmark minimum.

At x = 0.757248757841856:

  • The existing documentation returns approximately +6.182224.
  • The benchmark returns approximately −6.020740.

Changes

  • Replace math.sin(term / 2) with math.sin(2 * term) in both documentation examples.
  • Correct the README’s approximate minimum from -6.03 to -6.02074.
  • Add hola-py/tests/test_doc_objectives.py to compare both documented objectives against the existing benchmark at five inputs, including the approximate minimiser and domain endpoints.

The regression test evaluates only the objective functions extracted from the Markdown examples. It does not execute optimisation studies or remote-client examples and requires no third-party dependencies or compiled Rust bindings.

Validation

python3 -m unittest discover -s hola-py/tests -p test_doc_objectives.py -v
  • Before the corrections: all 10 numerical comparisons fail.
  • After the corrections: the test passes with all 10 comparisons agreeing within 1e-12.

Full Rust/Python suites and Ruff checks were not run because the required tooling and compiled bindings were unavailable in the validation environment.

No changes to the optimisation engine, public API or existing benchmark implementation.

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.

1 participant