Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #209: Handling argument list containing 0s in NumberPartition #245

Closed
wants to merge 1 commit into from
Closed

Fixes #209: Handling argument list containing 0s in NumberPartition #245

wants to merge 1 commit into from

Conversation

lumapools
Copy link

@lumapools lumapools commented Jun 1, 2023

Description

  • Instantiating NumberPartition with a list that contains at least one 0, i.e. [0, 3, 7, 9] will show a warning: Warning: Omitting zeros in the numbers list. Instantiate with keep0=True to keep 0 terms.
    and remove the 0s from the list, unless the user specifically states to keep the zeros by instantiating NumberPartition with the keep0=True argument (False by default).
  • If keep0=True but the list does not contain any 0s, then the list remains unchanged.
  • If keep0=True and the list contains at least one 0, then no warning is displayed and the list remains unchanged.
  • Fixes Warning if 0 is passed in numbers_list in NumberPartition problem #209

Checklist

  • I have performed a self-review of my code.
  • I have commented my code and used numpy-style docstrings
  • I have made corresponding updates to the documentation.
  • My changes generate no new warnings
  • I have added/updated tests to make sure bugfix/feature works.
  • New and existing unit tests pass locally with my changes.

Type of change

  • New feature (non-breaking change which adds functionality) [optimization]

How Has This Been Tested?

  • Tested locally by manually instantiating different cases of NumberPartition and changing the list arguments and keep0 to see the functionality outside unit tests.
  • Written unit tests for different cases that cover the code additions

Name the new unit-tests that you have added along with this change.
In test_problems.py, added a unit test test_number_partitioning_handles_0_in_numbers()

@lumapools lumapools changed the title Fixes issue #209: Handling argument list containing 0s in NumberPartition Fixes #209: Handling argument list containing 0s in NumberPartition Jun 1, 2023
@lumapools lumapools closed this by deleting the head repository Jun 5, 2023
@vishal-ph vishal-ph added the unitary_fund A feature supported by an UF grant label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unitary_fund A feature supported by an UF grant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning if 0 is passed in numbers_list in NumberPartition problem
2 participants