First, deploy a VQE ansatz and optimizer plugins that should just work:
$ ck deploy_optimizer vqe --value=optimizer.cobyla
$ ck deploy_ansatz vqe --value=ansatz.universal4
Then, launch VQE with the deployed optimizer and ansatz:
$ ck run vqe --device=local_qasm_simulator --repetitions=1
ck run program:visualize-convergence
$ ck run vqe --device=<device> --sample_size=<sample_size> --max_iterations=<max_iterations> --start_param_value=<start_param_value> --repetitions=<repetitions>
where:
- device
: local_qasm_simulator
(local simulator), ibmq_qasm_simulator
(remote simulator), ibmqx4
(remote hardware); by default, QCK will prompt to select one of these target quantum devices (0, 1, 2).
- sample_size
: the number of times to evaluate the Hamiltonian function on the quantum device ("sampling resolution") per optimizer iteration; by default, 100.
- max_iterations
: the maximum number of optimizer iterations ("iteration limit"); by default, 80.
- start_param_value
: the starting value of each optimizer's parameter (can be a float number or the word 'random')
- repetitions
: the number of times to repeat the experiment with the same parameters; by default, 3.
NB: The aim is to minimize the Time-To-Solution metric (TTS). As TTS is proportional to sample_size
, exploring lower values of sample_size
may be sensible.
At the same time, a low number of repetitions
may make it hard to demonstrate solution convergence with a high probability. For experiments to be uploaded, we recommend using at least 10 repetitions on the simulators and 3-5 repetitions on the hardware.
soft
and env
entries)$ ck search --tags=deployed
$ ck cleanup vqe --type=optimizer
$ ck cleanup vqe --type=ansatz
$ ck cleanup vqe
$ ck deploy_optimizer vqe
vi
)$ ck plugin_path vqe --type=optimizer
$ vi `ck plugin_path vqe --type=optimizer`
NB: The optimizer plugin is written in Python. It is expected to contain only one top-level function. If you need more, please define them within the top-level one.
$ ck deploy_ansatz vqe
display
)$ ck run program:visualize-ansatz
$ display `ck find program:visualize-ansatz`/ansatz_circuit.png
NB: If unsure about the image viewer, try eog
or eom
on Linux, open
on macOS.
vi
)$ ck plugin_path vqe --type=ansatz
$ vi `ck plugin_path vqe --type=ansatz`
NB: The ansatz plugin is written in Python with QISKit. It is expected to contain only one top-level function. If you need more, please define them within the top-level one.
You can list all your experimental entries and locate them on disk as follows:
$ ck search local:experiment:* --tags=qck
$ ck find local:experiment:*
Run the following and select an experiment entry to compute TTS for:
$ ck time_to_solution vqe --delta=0.015 --prob=0.95
To compute TTS for a particular experiment, supply its entry e.g.:
$ ck time_to_solution vqe --delta=0.015 --prob=0.8 local:experiment:anton-2018_10_05T12_18_19-local_qasm_simulator-ansatz.universal4-optimizer.cobyla-samples.100-repetitions.1
When you have an experiment you would like to share, run:
$ ck upload vqe --team=schroedinger-cat-herders
and select the experiment from the list. We recommend uploading all experiments on the hardware and most successful experiments on the simulators.
Alternatively, upload one or more experiments by using their entries e.g.:
$ ck upload vqe --team=bell-state-ringers local:experiment:my_experiment_5 local:experiment:my_experiment_13