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

Fix pulp cbc cmd solver params #778

Merged
merged 6 commits into from
Oct 22, 2024

Conversation

marcusreaiche
Copy link
Contributor

PR

  • The PULP_CBC_CMD solver is not correctly processing some parameters when calling CBC.
  • This is the case for the presolve and cuts arguments.
  • For example, when calling solve with presolve=False, the option presolve on is still passed to the command line.
  • Moreover, Pulp's documentation on PULP_CBC_CMD states that the strong parameter is of type bool.
  • However, it is of type int as mentioned is CBC's help.
  • New unit tests that check the command line instruction passed to CBC are created.

The following Google Colab Notebook presents all the issues and the corresponding fixes.

https://colab.research.google.com/drive/18afePVGohf9Bumns6ziiXjuoAI6SrJZL?usp=sharing

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@marcusreaiche
Copy link
Contributor Author

Commit 29ab059 removed the type annotations for compatibility with older Python versions.

@pchtsp
Copy link
Collaborator

pchtsp commented Oct 4, 2024

Thanks, until now, we had them as flags of None/ not None. I guess it makes sense to be able to pass False if we want to deactivate them.

Since these tests only affect CBC, I recommend to add them as methods of the CBC class:

pulp/pulp/tests/test_pulp.py

Lines 1439 to 1443 in 6af3801

class PULP_CBC_CMDTest(BaseSolverTest.PuLPTest):
solveInst = PULP_CBC_CMD

@marcusreaiche
Copy link
Contributor Author

marcusreaiche commented Oct 8, 2024

Hey Franco,

Thanks for your recommendations.

  • I moved the new tests to the PULP_CBC_CMDTest class.
  • I also moved the helper methods implemented in pulp/tests/utilities.py to the same class as static methods
    • Since they are only used to extract information from the CBC log file, I believe it is more logical to include them within this class.

Please let me know if you have any other suggestions.

@pchtsp pchtsp merged commit de9b104 into coin-or:master Oct 22, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants