parallel_solve

parallel_solve(
model: Sequence[Model | Poly | Matrix | Constraint | ConstraintList] | Model | Poly | Matrix | Constraint | ConstraintList,
client: BaseClient | amplify.CustomClientProtocol | Sequence[BaseClient | amplify.CustomClientProtocol],
*,
dry_run: Sequence[bool] | bool = False,
integer_encoding_method: Sequence[Literal['Unary', 'Linear', 'Binary', 'Default'] | IntegerEncodingMethod] | Literal['Unary', 'Linear', 'Binary', 'Default'] | IntegerEncodingMethod = IntegerEncodingMethod.Default,
real_encoding_method: Sequence[Literal['Random4', 'Random8', 'Random16', 'Random32'] | RealEncodingMethod] | Literal['Random4', 'Random8', 'Random16', 'Random32'] | RealEncodingMethod = RealEncodingMethod.Random16,
quadratization_method: Sequence[Literal['IshikawaKZFD', 'Substitute'] | QuadratizationMethod] | Literal['IshikawaKZFD', 'Substitute'] | QuadratizationMethod = QuadratizationMethod.Substitute,
substitution_multiplier: Sequence[float] | float = 1.0,
embedding_method: Sequence[Literal['Default', 'Minor', 'Clique', 'Parallel'] | EmbeddingMethod] | Literal['Default', 'Minor', 'Clique', 'Parallel'] | EmbeddingMethod = EmbeddingMethod.Default,
embedding_timeout: Sequence[timedelta | float] | timedelta | float = 10.0,
chain_strength: Sequence[float] | float = 1.0,
num_solves: Sequence[int] | int = 1,
filter_solution: Sequence[bool] | bool = True,
sort_solution: Sequence[bool] | 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.

パラメータ:
  • model (Sequence[Model | Poly | Matrix | Constraint | ConstraintList] | Model | Poly | Matrix | Constraint | ConstraintList) -- Problems to solve.

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

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

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

  • real_encoding_method (Sequence[Literal['Random4', 'Random8', 'Random16', 'Random32'] | amplify.RealEncodingMethod] | typing.Literal['Random4', 'Random8', 'Random16', 'Random32'] | amplify.RealEncodingMethod) -- Algorithm for converting real variables to binary/Ising variables. Defaults to RealEncodingMethod.Random16.

  • quadratization_method (Sequence[Literal['IshikawaKZFD', 'Substitute'] | amplify.QuadratizationMethod] | typing.Literal['IshikawaKZFD', 'Substitute'] | amplify.QuadratizationMethod) -- Algorithm for reducing degree of polynomial. Defaults to QuadratizationMethod.Substitute.

  • substitution_multiplier (Sequence[float] | float) -- Multiplier for substitution penalty scaling (used only with Substitute). Defaults to 1.0.

  • embedding_method (Sequence[Literal['Default', 'Minor', 'Clique', 'Parallel'] | amplify.EmbeddingMethod] | typing.Literal['Default', 'Minor', 'Clique', 'Parallel'] | amplify.EmbeddingMethod) -- Embedding algorithm. Defaults to EmbeddingMethod.Default.

  • embedding_timeout (Sequence[timedelta | float] | timedelta | float) -- Embedding timeout in seconds. Defaults to 10.0.

  • chain_strength (Sequence[float] | float) -- Chain strength for embedding. Defaults to 1.0.

  • num_solves (Sequence[int] | int) -- Number of independent solves. Defaults to 1.

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

  • sort_solution (Sequence[bool] | bool) -- Whether to sort solutions by objective value, default is True. Defaults to True.

  • concurrency (int) -- Max concurrency (0 lets the SDK choose). Defaults to 0.

戻り値:

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

戻り値の型:

list[Result | None]