Gmpb Dynamic Problem

Source: examples/optimization/gmpb_dynamic_problem.py

Introduction

Inspect the packaged dynamic GMPB optimization wrapper.

Technical Implementation

This page is generated from the top-of-file module docstring and the example source code. The full script is included below for direct inspection.

 1from __future__ import annotations
 2
 3import numpy
 4
 5import design_research_problems as derp
 6
 7
 8def main() -> None:
 9    """Print stateful GMPB evaluation and solve details."""
10    problem = derp.get_problem("gmpb_default_dynamic_min")
11    print(problem.metadata.problem_id)
12    print(f"dimension {problem.bounds.lb.shape[0]}")
13    print(f"before env={problem.current_environment_index()} evals={problem.evaluations_in_environment()}")
14    candidate = numpy.zeros(problem.bounds.lb.shape, dtype=float)
15    evaluation = problem.evaluate(candidate)
16    print(f"evaluate objective={evaluation.objective_value:.6f}")
17    print(f"after env={problem.current_environment_index()} evals={problem.evaluations_in_environment()}")
18    result = problem.solve(seed=3, maxiter=16)
19    print(f"solve best={result.fun:.6f} nfev={result.nfev}")
20    print(f"final env={problem.current_environment_index()} evals={problem.evaluations_in_environment()}")
21
22
23if __name__ == "__main__":
24    main()

Expected Results

Run Command

PYTHONPATH=src python3 examples/optimization/gmpb_dynamic_problem.py

Run the command shown below from repository root. Output should summarize the problem setup, a baseline solution, or diagnostic values relevant to this example.