To start this exercise, we'll look at a complete Ocean program that uses the
package dwave.graphs. dwave-graphs provides tools for working with quantum processing unit (QPU) topology graphs, such as the Pegasus used on the Advantage™ quantum computer, and implementations of graph-theory algorithms on D-Wave™ quantum computers and other binary quadratic model (BQM) samplers. The base problem of this exercise is the antenna selection problem from the D-Wave Collection of
Examples.
Run original_program.py. Read through the code and take a look at the structure of the program. In
particular, pay attention to:
- How are we creating the graph structure?
- How are we defining and calling our sampler?
Open change_sampler.py. This file is identical to original_program.py,
but does not have a sampler defined. Set up your sampler in the
set_sampler function to run the simulated annealing algorithm.
Note: Don't forget to import the package where the sampler lives. You may find the Ocean documentation useful.
Open change_problem.py. This file is identical to original_program.py,
but is missing the following things: (1) a graph definition, and (2) a graph
algorithm from dwave.graphs. Fill in the functions create_graph and
solve_problem in this program to solve the minimum vertex cover on the
following graph.
Released under the Apache License 2.0. See LICENSE file.
