Skip to main content
IBM Quantum Platform
Informações sobre tradução

Traduções adicionais para esta página em outros idiomas estarão disponíveis em breve.

Q-CTRL Optimization Solver by Global Data Quantum API reference


Inputs

problem

Tipo: str or SparsePauliOp

Valor Padrão: None

One of the representations listed under "Accepted problem formats".

  • Required: Yes
  • Example: Poly(2.0*n[0]*n[1] + 2.0*n[0]*n[2] - 3.13520241298341*n[0] + 2.0*n[1]*n[2] - 3.14469748506794*n[1] - 3.18897660121566*n[2] + 6.0, n[0], n[1], n[2], domain='RR')

problem_type

Tipo: str

Valor Padrão: None

Name of the problem class; only used for graph and spin chain problem definitions, which are limited to "maxcut" or "spin_chain"; not required for arbitrary objective function problem definitions.

  • Required: No
  • Example: "maxcut"

backend_name

Tipo: str

Valor Padrão: Least busy backend

Name of the backend to use.

  • Required: No
  • Example: "ibm_fez"

constraint

Tipo: dict[tuple, int]

Valor Padrão: None

Optional Hamming-weight constraints for the problem variables. Each constraint specifies a group of variables that must sum to exactly 1 (that is, exactly one variable in the group is 1 and the rest are 0). If not provided, the solver treats the problem as unconstrained and searches over all possible bitstrings. You do not need to constrain every variable — variables left out of constraint remain unconstrained, so partially constrained problems are supported. Keys are tuples of variable indices, or variable names when using a polynomial problem input.

  • Required: No
  • Example: {("n[0,0]", "n[0,1]", "n[0,2]"): 1}

function_size

Tipo: str

Valor Padrão: "M"

Size the job runs at: "S", "M", or "L". The required size depends on the number of binary decision variables and the interaction density, the fraction of variable pairs that interact: up to 50 variables and 10% density is "S", up to 100 variables and 25% density is "M", and anything larger is "L". To calculate the size before you submit a job, see Function sizes. If the size is too small, the job fails with error 4600. If the size is larger than the job needs, the job runs normally and records a 4601 advisory event.

  • Required: No
  • Example: "L"

Options

Tipo: dict

Valor Padrão: None

Input options, including the following: (Optional) session_id: str; default behavior creates a new Session. Options are specified as a nested dictionary. See the full list of options and their default values.

  • Required: No
  • Example: {"session_id": "cw2q70c79ws0008z6g4g"}

Options list

session_id

Tipo: str

Valor Padrão: None

An existing IBM Quantum Compute Service session ID.

  • Default: None
  • Example: "cw4r3je6f0t010870y3g"
job_tags

Tipo: list[str]

Valor Padrão: None

A list of job tags.

  • Default: None
  • Example: ["job_tag1", "job_tag2"]

Outputs

result

Tipo: dict[str, Any]

Solution and metadata listed under Result dictionary contents.

Example: {'solution_bitstring_cost': 3.0, final_bitstring_distribution: {000001: 100, 000011: 2}, iteration_count: 3, 'solution_bitstring': 000001, 'variables_to_bitstring_index_map': {n[1]': 5, 'n[2]': 4, 'n[3]': 3, 'n[4]': 2, 'n[5]': 1}, 'best_parameters': [0.19628831763697097, -1.047052334523102], 'warnings': []}

Result dictionary contents

solution_bitstring_cost

Tipo: float

The best minimum cost across all iterations.

final_bitstring_distribution

Tipo: CountsDict

The bitstring counts dictionary associated with the minimum cost.

solution_bitstring

Tipo: str

Bitstring with the best cost in the final distribution.

iteration_count

Tipo: int

The total number of QAOA iterations performed by the Solver.

variables_to_bitstring_index_map

Tipo: float

The mapping from the variables to the equivalent bit in the bitstring.

best_parameters

Tipo: list[float]

The optimized beta and gamma parameters across all iterations.

warnings

Tipo: list[str]

Valor Padrão: None

The warnings produced while compiling or running QAOA.


Error handling

The function reports the following errors that relate to function_size. For all error codes, see the IBM Quantum error codes.

Code
Cause
4600The function_size is too small for the workload. The job fails, and the message names the size to use.
4601The function_size is larger than the workload needs. The job runs normally and records an advisory event that you can read with job.events().
Esta página foi útil?
Relate um bug, erro de digitação ou solicite conteúdo no GitHub.