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,
Solve multiple problems in parallel.
Solve multiple
(model, client)jobs concurrently. Bothmodelandclientaccept 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 toFalse.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 toEmbeddingMethod.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 toTrue.concurrency (int) β Whether to sort solutions by objective value, default is
True. Defaults to0.
- Returns:
Results for each job. An entry can be
Noneif all solves in that job failed.- Return type: