7735260c7da1eea7afb9dd629ddd17bea9cd8b74,qiskit/optimization/algorithms/grover_optimizer.py,GroverOptimizer,solve,#GroverOptimizer#Any#,92

Before Change


        // Build the results object.
        grover_results = GroverOptimizationRawResult(operation_count, n_key, n_value, func_dict)
        fval = solutions[optimum_key]
        if sense == problem_.objective.Sense.MAXIMIZE:
            fval = -fval
        result = OptimizationResult(x=opt_x, fval=fval, variables=problem.variables,
                                    raw_results={"grover_results": grover_results,
                                                 "qubo_converter": copy.deepcopy(
                                                     self._qubo_converter),

After Change


                problem_.objective.linear[i] = -val
            for (i, j), val in problem_.objective.quadratic.to_dict().items():
                problem_.objective.quadratic[i, j] = -val
        self._num_key_qubits = len(problem_.objective.linear.to_array())

        // Variables for tracking the optimum.
        optimum_found = False
        optimum_key = math.inf
        optimum_value = math.inf
        threshold = 0
        n_key = len(problem_.variables)
        n_value = self._num_value_qubits

        // Variables for tracking the solutions encountered.
        num_solutions = 2 ** n_key
        keys_measured = []

        // Variables for result object.
        operation_count = {}
        iteration = 0

        // Variables for stopping if we"ve hit the rotation max.
        rotations = 0
        max_rotations = int(np.ceil(100 * np.pi / 4))

        // Initialize oracle helper object.
        qr_key_value = QuantumRegister(self._num_key_qubits + self._num_value_qubits)
        orig_constant = problem_.objective.constant
        measurement = not self.quantum_instance.is_statevector
        oracle = self._get_oracle(qr_key_value)

        while not optimum_found:
            m = 1
            improvement_found = False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: Qiskit/qiskit-aqua
Commit Name: 7735260c7da1eea7afb9dd629ddd17bea9cd8b74
Time: 2020-08-04
Author: jules.gacon@googlemail.com
File Name: qiskit/optimization/algorithms/grover_optimizer.py
Class Name: GroverOptimizer
Method Name: solve


Project Name: elfi-dev/elfi
Commit Name: e3f4b018d3591f239c6d59cc93b895be4c1791fa
Time: 2017-03-31
Author: jarno.lintusaari@aalto.fi
File Name: elfi/methods/methods.py
Class Name: BayesianOptimization
Method Name: update


Project Name: elfi-dev/elfi
Commit Name: 08f049c9fc5fc0f3da5a830de72a583007cdec66
Time: 2017-03-31
Author: jarno.lintusaari@aalto.fi
File Name: elfi/methods/methods.py
Class Name: BayesianOptimization
Method Name: __init__