Plans#
- blop.plans.optimize(optimization_problem, iterations=1, n_points=1, checkpoint_interval=None, readable_cache=None, **kwargs)[source]#
A plan to solve the optimization problem.
- Parameters:
- optimization_problemOptimizationProblem
The optimization problem to solve.
- iterationsint, optional
The number of optimization iterations to run.
- n_pointsint, optional
The number of points to suggest per iteration.
- checkpoint_intervalint | None, optional
The number of iterations between optimizer checkpoints. If None, checkpoints will not be saved. Optimizer must implement the
blop.protocols.Checkpointableprotocol.- readable_cache: dict[str, InferredReadable] | None = None
Cache of readable objects to store the suggestions and outcomes as events. If None, a new cache will be created.
- **kwargsAny
Additional keyword arguments to pass to the
optimize_step()plan.
See also
blop.protocols.OptimizationProblemThe problem to solve.
blop.protocols.CheckpointableThe protocol for checkpointable objects.
optimize_stepThe plan to execute a single step of the optimization.
- blop.plans.optimize_step(optimization_problem, n_points=1, *args, **kwargs)[source]#
A single step of the optimization loop.
- Parameters:
- optimization_problemOptimizationProblem
The optimization problem to solve.
- n_pointsint, optional
The number of points to suggest.
- Returns:
- tuple[list[dict], list[dict]]
A tuple containing the suggestions and outcomes of the step.
- blop.plans.default_acquire(suggestions, actuators, sensors=None, *, per_step=None, **kwargs)[source]#
A default plan to acquire data for optimization. Simply a list scan.
Includes a default metadata key “blop_suggestion_ids” which can be used to identify the suggestions that were acquired for each step of the scan.
- Parameters:
- suggestions: list[dict]
A list of dictionaries, each containing the parameterization of a point to evaluate. The “_id” key is optional and can be used to identify each suggestion. It is suggested to add “_id” values to the run metadata for later identification of the acquired data.
- actuators: Sequence[Actuator]
The actuators to move and the inputs to move them to.
- sensors: Sequence[Sensor]
The sensors that produce data to evaluate.
- per_step: bp.PerStep | None, optional
The plan to execute for each step of the scan.
- **kwargs: Any
Additional keyword arguments to pass to the list_scan plan.
- Returns:
- str
The UID of the Bluesky run.
See also
bluesky.plans.list_scanThe Bluesky plan to acquire data.
- blop.plans.acquire_baseline(optimization_problem, parameterization=None, **kwargs)[source]#
Acquire a baseline reading. Useful for relative outcome constraints.
- Parameters:
- optimization_problemOptimizationProblem
The optimization problem to solve.
- parameterizationdict[str, Any] | None = None
Move the DOFs to the given parameterization, if provided.
See also
default_acquireThe default plan to acquire data.
- blop.plans.sample_suggestions(optimization_problem, suggestions, readable_cache=None, **kwargs)[source]#
Evaluate specific parameter combinations.
This plan acquires data for given suggestions and ingests results into the optimizer. Supports both optimizer-generated suggestions (with “_id”) and manual points (without “_id”, if optimizer implements CanRegisterSuggestions).
- Parameters:
- optimization_problemOptimizationProblem
The optimization problem.
- suggestionslist[dict]
Parameter combinations to evaluate. Can be:
Optimizer suggestions (with “_id” keys from suggest())
Manual points (without “_id”, requires CanRegisterSuggestions protocol)
- readable_cachedict[str, InferredReadable] | None
Cache for storing suggestions/outcomes as events.
- **kwargsAny
Additional arguments for acquisition plan.
- Returns:
- uidstr
Bluesky run UID.
- suggestionslist[dict]
Suggestions with “_id” keys.
- outcomeslist[dict]
Evaluated outcomes.
- Raises:
- ValueError
If suggestions lack “_id” and optimizer doesn’t implement CanRegisterSuggestions.
See also
optimize_stepStandard optimizer-driven step.
blop.protocols.CanRegisterSuggestionsProtocol for manual suggestions.