AggregationStrategy¶
- class AggregationStrategy[source]¶
Bases:
ABCCombines per-partition candidates into scored global solutions.
Subclasses implement
aggregate(), which receives the executed programs plus the problem-specific hooks needed to build and score global solutions, and returns the top-N(score, solution)pairs.Methods Summary
aggregate(programs, initial_solution, ...[, ...])Aggregate per-partition candidates into the top-N global solutions.
Methods Documentation
- abstractmethod aggregate(programs, initial_solution, extend_fn, evaluate_fn, top_n=1)[source]¶
Aggregate per-partition candidates into the top-N global solutions.
- Parameters:
programs (
dict[Any,SolutionSamplingMixin]) – Mapping of program IDs to executedVariationalQuantumAlgorithminstances.initial_solution (
Sequence[int]) – Starting global solution vector (typically all zeros).extend_fn (
Callable[[list[int],Any,SolutionEntry],list[int]]) –(current_solution, prog_id, candidate) -> extended_solution; splices a partition’s candidate into the global vector.evaluate_fn (
Callable[[list[int]],float]) –(solution) -> float. Lower is better.top_n (
int) – Number of top solutions to return.
- Return type:
- Returns:
List of
(score, solution)tuples sorted ascending by score (best first), with at mosttop_nentries.