Skip to content

Commit

Permalink
add bqp_tsp example
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Jul 9, 2024
1 parent 828c12a commit 1139343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 4 additions & 6 deletions docs/source/example_bqm_tsp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 27,
"metadata": {},
"outputs": [
{
Expand All @@ -65,15 +65,14 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[DecodedSample(1.0, {'order': (2, 0, 1)}), DecodedSample(1.0, {'order': (1, 2, 0)}), DecodedSample(1.0, {'order': (1, 2, 0)}), DecodedSample(3.0, {'order': (0, 3, 2)}), DecodedSample(3.0, {'order': (2, 2, 2)}), DecodedSample(3.0, {'order': (2, 3, 2)}), DecodedSample(3.0, {'order': (1, 3, 0)}), DecodedSample(3.0, {'order': (3, 0, 3)}), DecodedSample(3.0, {'order': (3, 2, 0)}), DecodedSample(3.0, {'order': (3, 2, 3)})]\n",
"{'order': (2, 0, 1)}\n"
"{'order': (0, 1, 2)}\n"
]
}
],
Expand All @@ -84,7 +83,6 @@
"sa = neal.SimulatedAnnealingSampler()\n",
"sampleset = sa.sample(bqm, num_reads=10)\n",
"decoded_samples = decode_samples(tsp_f, sampleset)\n",
"print(decoded_samples)\n",
"best_sample = min(decoded_samples, key=lambda x: x.energy)\n",
"print(best_sample.sample)\n"
]
Expand Down
3 changes: 1 addition & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ quantum annealers, ising machines, simulators, etc.
example_bernstein_vazirani.ipynb
example_unitary_of_f.ipynb
example_big_circuit.ipynb

.. example_bqm_tsp.ipynb
example_bqm_tsp.ipynb


Indices and tables
Expand Down

0 comments on commit 1139343

Please sign in to comment.