qiskit-optimization icon indicating copy to clipboard operation
qiskit-optimization copied to clipboard

Solving a bug in the MaxCut class

Open Maldini32 opened this issue 1 year ago • 1 comments

Environment

  • Qiskit Optimization version: 0.45.1
  • Python version: 3.10
  • Operating system: Windows 10

What is happening?

The problem regards the method parse_gset_format, which should be updated in order to correctly read the files.

While in the library version we can find this content in lines 117 to 120:

s__, t__, _ = v
s__ -= 1  # adjust 1-index
t__ -= 1  # ditto
w[s__, t__] = t__

They should be replace with these lines in order to properly assign the weight to the edges:

s__, t__, _ = v
s__ -= 1  # adjust 1-index
t__ -= 1  # ditto
w[s__, t__] = _

How can we reproduce the issue?

The problem is solved by modifying the 120 to:

w[s__, t__] = _

What should happen?

By modifying this line the weights will be correctly assigned to the problem instance.

Any suggestions?

No response

Maldini32 avatar Feb 19 '24 11:02 Maldini32