Skip to content

Warning if 0 is passed in numbers_list in NumberPartition problem #209

Open
@vishal-ph

Description

@vishal-ph

Prerequisites

Before raising this issue, I have already checked that I am:

  • running the latest version
  • made sure that this issue has not already been filed

Describe the bug

Upon creating an instance of the NumberPartition problem with a 0 entry in the list, the problem is created with redundant qubit and terms. These terms then manifest as extra cost gates with angle=0.

To Reproduce

Steps to reproduce the behavior:

from openqaoa.problems import NumberPartition
np = NumberPartition([0,2,3,5,8])
np_qubo = np.qubo()
np_qubo.hamiltonian.expression

Expected behavior

The problem class should catch 0 in the list and raise a warning while removing the zero from the list, and create a problem with the remaining qubits.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions