You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make a GroverRunner class that takes as input an instance of subset sum (a list of positive numbers numbers, and a positive number target) and it should:
Create an oracle through an instance of SubsetSumOracle, by passing numbers and target as arguments
Define a verifier method, which takes as input a list of numbers subset (of 0's and 1's) and returns true if the sum of numbers multiplied by the 0 or 1 at the same index of subset is equal to target, defined as:
def verifier(subset):
return sum(w * s for w, s in zip(numbers, subset)) == target
Create a quantum circuit through an instance GroverSolver, passing as arguments the oracle, the length of numbers, the verifier method and the backend that we want to use to run it (AerSimulator() for tests and quantum-inspire or IBM for the official run).
Run the generated quantum circuit with the computed number of solution, using run_known_solutions(), using the estimated number of solutions
Plot an histogram with the results of the simulations and return the top 1 most frequent solution (or the top k where k is the number of estimated solutions)
Make a
GroverRunnerclass that takes as input an instance of subset sum (a list of positive numbersnumbers, and a positive numbertarget) and it should:oraclethrough an instance ofSubsetSumOracle, by passingnumbersandtargetas argumentsverifiermethod, which takes as input a list of numberssubset(of 0's and 1's) and returns true if the sum ofnumbersmultiplied by the 0 or 1 at the same index ofsubsetis equal to target, defined as:SolutionEstimator(still TODO see Make a SolutionEstimator using phase estimation #5 )GroverSolver, passing as arguments theoracle, the length ofnumbers, theverifiermethod and the backend that we want to use to run it (AerSimulator()for tests and quantum-inspire or IBM for the official run).run_known_solutions(), using the estimated number of solutions