aefba06234c63a950bac21c9d4f07e97ebed7d5f,qiskit/optimization/algorithms/minimum_eigen_optimizer.py,MinimumEigenOptimizer,solve,#MinimumEigenOptimizer#Any#,128
Before Change
samples = eigenvector_to_solutions(eigen_results.eigenstate, operator)
samples = [(res[0], problem_.objective.sense.value * (res[1] + offset), res[2])
for res in samples]
samples.sort(key=lambda x: problem_.objective.sense.value * x[1])
// translate result back to integers
opt_res = MinimumEigenOptimizerResult(samples[0][0], samples[0][1], samples, qubo_converter)
opt_res = qubo_converter.decode(opt_res)
After Change
operator, offset = operator_converter.encode(problem_)
// only try to solve non-empty Ising Hamiltonians
if operator.num_qubits > 0:
// approximate ground state of operator using min eigen solver
eigen_results = self._min_eigen_solver.compute_minimum_eigenvalue(operator)
// analyze results
samples = eigenvector_to_solutions(eigen_results.eigenstate, operator)
samples = [(res[0], problem_.objective.sense.value * (res[1] + offset), res[2])
for res in samples]
samples.sort(key=lambda x: problem_.objective.sense.value * x[1])
x = samples[0][0]
fval = samples[0][1]
// if Hamiltonian is empty, then the objective function is constant to the offset
else:
x = [0]*problem_.get_num_binary_vars()
fval = offset
x_str = "0"*problem_.get_num_binary_vars()
samples = [(x_str, offset, 1.0)]
// translate result back to integers
opt_res = MinimumEigenOptimizerResult(x, fval, samples, qubo_converter)
opt_res = qubo_converter.decode(opt_res)
// translate results back to original problem
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: Qiskit/qiskit-aqua
Commit Name: aefba06234c63a950bac21c9d4f07e97ebed7d5f
Time: 2020-05-14
Author: 41292468+stefan-woerner@users.noreply.github.com
File Name: qiskit/optimization/algorithms/minimum_eigen_optimizer.py
Class Name: MinimumEigenOptimizer
Method Name: solve
Project Name: dmlc/dgl
Commit Name: b372b3c796f7d0528103e5b194810dcddb6a80db
Time: 2020-06-16
Author: mctt90@gmail.com
File Name: python/dgl/distributed/kvstore.py
Class Name: KVClient
Method Name: pull
Project Name: onnx/onnx-coreml
Commit Name: 660fbdb4facf97ddfb46b5a4f28a80e7db3aec43
Time: 2018-09-16
Author: aseem.elec@gmail.com
File Name: onnx_coreml/_transformers.py
Class Name: UnsqueezeRemover
Method Name: __call__