optimise
optimise(executor, ranges, n_start=20, n_step=10, max_iter=5, max_hours=None)Runs the automated Active Learning loop (Initialize -> Execute -> Diagnose -> Refine).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| executor | Executor | str | The solver adapter to use (e.g., PythonExecutor, MatlabExecutor). Accepts a legacy command string for backward compatibility. | required |
| ranges | Dict | Input bounds, e.g. {“Length”: (0, 10)}. | required |
| n_start | int | Initial sample size (only if data is empty). | 20 |
| n_step | int | Batch size for refinement. | 10 |
| max_iter | int | Max refinement loops. | 5 |
| max_hours | float | Physical time limit in hours to safely stop the loop. | None |
Examples
from digiqual.core import SimulationStudy
from digiqual.executors import PythonExecutor
# 1. Define the variable ranges
ranges = {"Length": (0, 10), "Angle": (-45, 45)}
study = SimulationStudy(input_cols=["Length", "Angle"], outcome_col="Signal")
# 2. Define a simple Python solver
def my_solver(row):
return row['Length'] * 2 + row['Angle']
my_exec = PythonExecutor(solver_func=my_solver, outcome_col="Signal")
# 3. Run the automated loop
study.optimise(
executor=my_exec,
ranges=ranges,
max_iter=3
)
# 4. View the results
_ = study.pod(poi_col="Length", threshold=4.0)
study.visualise()