parallel_solveΒΆ

parallel_solve(
model: Model | Poly | Matrix | Constraint | ConstraintList | Sequence[Model | Poly | Matrix | Constraint | ConstraintList],
client: BaseClient | amplify.CustomClientProtocol | Sequence[BaseClient | amplify.CustomClientProtocol],
*,
dry_run: bool | Sequence[bool] = False,
integer_encoding_method: Literal['Unary', 'Linear', 'Binary', 'Default'] | IntegerEncodingMethod | Sequence[Literal['Unary', 'Linear', 'Binary', 'Default'] | IntegerEncodingMethod] = IntegerEncodingMethod.Default,
quadratization_method: Literal['IshikawaKZFD', 'Substitute'] | QuadratizationMethod | Sequence[Literal['IshikawaKZFD', 'Substitute'] | QuadratizationMethod] = QuadratizationMethod.Substitute,
substitution_multiplier: float | Sequence[float] = 1.0,
embedding_method: Literal['Default', 'Minor', 'Clique', 'Parallel'] | EmbeddingMethod | Sequence[Literal['Default', 'Minor', 'Clique', 'Parallel'] | EmbeddingMethod] = EmbeddingMethod.Default,
embedding_timeout: float | timedelta | Sequence[float | timedelta] = 10.0,
chain_strength: float | Sequence[float] = 1.0,
num_solves: int | Sequence[int] = 1,
filter_solution: bool | Sequence[bool] = True,
sort_solution: bool | Sequence[bool] = True,
concurrency: int = 0,
) list[Result | None]ΒΆ

Solve multiple problems in parallel.

Solve multiple (model, client) jobs concurrently. Both model and client accept either a single object or a sequence. - If one of them is a sequence, the single object is broadcast to all jobs. - If both are sequences, they must have the same length and are paired element-wise. Most keyword arguments also accept either a single value or a sequence and follow the same broadcasting rule.

Parameters:
  • model (Model | Poly | Matrix | Constraint | ConstraintList | Sequence[Model | Poly | Matrix | Constraint | ConstraintList]) – Problems to solve.

  • client (BaseClient | amplify.CustomClientProtocol | Sequence[BaseClient | amplify.CustomClientProtocol]) – Clients used for solving.

  • dry_run (bool | Sequence[bool]) – When True, perform conversion only (no solver execution). Defaults to False.

  • integer_encoding_method (Literal['Unary', 'Linear', 'Binary', 'Default'] | amplify.IntegerEncodingMethod | collections.abc.Sequence[typing.Literal['Unary', 'Linear', 'Binary', 'Default'] | amplify.IntegerEncodingMethod]) – Algorithm for converting integer variables to binary/Ising variables. Defaults to IntegerEncodingMethod.Default.

  • quadratization_method (Literal['IshikawaKZFD', 'Substitute'] | amplify.QuadratizationMethod | collections.abc.Sequence[typing.Literal['IshikawaKZFD', 'Substitute'] | amplify.QuadratizationMethod]) – Algorithm for converting real variables to binary/Ising variables. Defaults to QuadratizationMethod.Substitute.

  • substitution_multiplier (float | Sequence[float]) – Algorithm for reducing degree of polynomial. Defaults to 1.0.

  • embedding_method (Literal['Default', 'Minor', 'Clique', 'Parallel'] | amplify.EmbeddingMethod | collections.abc.Sequence[typing.Literal['Default', 'Minor', 'Clique', 'Parallel'] | amplify.EmbeddingMethod]) – Multiplier for substitution penalty scaling (used only with Substitute). Defaults to EmbeddingMethod.Default.

  • embedding_timeout (float | timedelta | Sequence[float | timedelta]) – Embedding algorithm. Defaults to 10.0.

  • chain_strength (float | Sequence[float]) – Embedding timeout in seconds. Defaults to 1.0.

  • num_solves (int | Sequence[int]) – Chain strength for embedding. Defaults to 1.

  • filter_solution (bool | Sequence[bool]) – Number of independent solves. Defaults to True.

  • sort_solution (bool | Sequence[bool]) – Whether to filter out infeasible solutions, default is True. Defaults to True.

  • concurrency (int) – Whether to sort solutions by objective value, default is True. Defaults to 0.

Returns:

Results for each job. An entry can be None if all solves in that job failed.

Return type:

list[Result | None]