Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update documentation to include SparsePauliOp spin chain input #2606

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docs/guides/q-ctrl-optimization-solver.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"![Visualization of the Optimization Solver workflow](/images/guides/qctrl-optimization/solver_workflow.svg)\n",
Copy link
Contributor

@rowenwu rowenwu Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Spin chain representation of a specific problem. The spin chain should be represented as a SparsePauliOp object.

Can this be updated for brevity?


Reply via ReviewNB

"\n",
"To solve a generic problem with the Optimization Solver:\n",
"1. Define your problem as an objective function or a graph.\n",
"1. Define your problem as an objective function, a graph, or `SparsePauliOp` spin chain.\n",
"2. Connect to the function through the Qiskit Functions Catalog.\n",
"3. Run the problem with the Solver and retrieve results."
]
Expand All @@ -45,17 +45,18 @@
"source": [
"## Inputs and outputs\n",
"### Inputs\n",
"| Name | Type | Description | Required | Default | Example |\n",
"| --------- | ---------------- | -------------------------- | -------- | ---------- | ---------- |\n",
"| problem | `str` | One of the representations listed under \"Accepted problem formats\" | Yes | N/A |`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')` |\n",
"| problem_type | `str` | Name of the problem class; only used for graph problem definitions, which are limited to \"maxcut\"; not required for arbitrary objective function problem definitions | No | `None`| `\"maxcut\"` |\n",
"| backend_name | `str` | Name of the backend to use | No | Least busy backend that your instance has access to | `\"hub1/group1/project1\"` |\n",
"| instance | `str` | The hub/group/project to use | No | A Premium access instance is randomly chosen if your account has access to multiple instances | `\"hub1/group1/project1\"` |\n",
"| options | `dict` | Input options, including the following: (Optional) `session_id`: `str`; default behavior creates a new Session | No | `None` | `{\"session_id\": \"cw2q70c79ws0008z6g4g\"}` |\n",
"| Name | Type | Description | Required | Default | Example |\n",
"| --------- |-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- | ---------- | ---------- |\n",
"| problem | `str` or `SparsePauliOp` | One of the representations listed under \"Accepted problem formats\" | Yes | N/A |`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')` |\n",
"| problem_type | `str` | 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 | No | `None`| `\"maxcut\"` |\n",
"| backend_name | `str` | Name of the backend to use | No | Least busy backend that your instance has access to | `\"hub1/group1/project1\"` |\n",
"| instance | `str` | The hub/group/project to use | No | A Premium access instance is randomly chosen if your account has access to multiple instances | `\"hub1/group1/project1\"` |\n",
"| options | `dict` | Input options, including the following: (Optional) `session_id`: `str`; default behavior creates a new Session | No | `None` | `{\"session_id\": \"cw2q70c79ws0008z6g4g\"}` |\n",
"\n",
"**Accepted problem formats:**\n",
"- Polynomial expression representation of an objective function. Ideally created in Python with an existing SymPy Poly object and formatted into a string using [sympy.srepr](https://docs.sympy.org/latest/tutorials/intro-tutorial/printing.html#srepr).\n",
"- Graph representation of a specific problem type. The graph should be created using the networkx library in Python. It should then converted to a string by using the networkx function `[nx.readwrite.json_graph.adjacency_data](http://nx.readwrite.json_graph.adjacency_data.)`.\n",
"- Spin chain representation of a specific problem. The spin chain should be represented as a `SparsePauliOp` object; see the [documentation](/api/qiskit/qiskit.quantum_info.SparsePauliOp) for more details.\n",
"\n",
"**Supported backends:**\n",
"The following list of backends are currently supported. If your device is not listed, [reach out to Q-CTRL](https://form.typeform.com/to/iuujEAEI?typeform-source=q-ctrl.com) to add support.\n",
Expand Down
Loading