From 4599e6cba84776d9358826f2bd5167bd37cae8e4 Mon Sep 17 00:00:00 2001 From: dwierichs Date: Fri, 1 Nov 2024 11:11:33 +0100 Subject: [PATCH] tiny fix --- demonstrations/tutorial_qaoa_maxcut.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/demonstrations/tutorial_qaoa_maxcut.py b/demonstrations/tutorial_qaoa_maxcut.py index 68e93975ba..084a6c9863 100644 --- a/demonstrations/tutorial_qaoa_maxcut.py +++ b/demonstrations/tutorial_qaoa_maxcut.py @@ -138,8 +138,7 @@ import pennylane as qml from pennylane import numpy as np -seed = 42 -np.random.seed(seed) +np.random.seed(42) ############################################################################## # Operators @@ -186,7 +185,7 @@ def bitstring_to_int(bit_string_sample): # ~~~~~~~ # Next, we create a quantum device with 4 qubits. -dev = qml.device("lightning.qubit", wires=n_wires, shots=1000) +dev = qml.device("lightning.qubit", wires=n_wires, shots=20) ############################################################################## # We also require a quantum node which will apply the operators according to the angle parameters, @@ -253,7 +252,7 @@ def qaoa_maxcut(n_layers=1): print(f"Objective after step {i+1:3d}: {-objective(params): .7f}") # sample 100 bitstrings by setting return_samples=True and the QNode shot count to 100 - bitstrings = circuit(*params, return_samples=True, shots=20) + bitstrings = circuit(*params, return_samples=True, shots=100) # convert the samples bitstrings to integers sampled_ints = [bitstring_to_int(string) for string in bitstrings]