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

Add support for MaxNode option with CBC solver #580

Closed
wants to merge 3 commits into from

Conversation

E-Aho
Copy link

@E-Aho E-Aho commented Sep 22, 2022

This commit adds support for the maxNodes option for the CBC solver. Includes a simple test to make sure the option is implemented correctly.

I originally tried to create a test to show that using the maxNodes option would cause the CBC solver to terminate upon reaching that number of nodes, but couldn't find an intuitive way to read the Enumerated Nodes or "stopping reason" outputs of the sovler in test cases.

@CLAassistant
Copy link

CLAassistant commented Sep 22, 2022

CLA assistant check
All committers have signed the CLA.

@E-Aho
Copy link
Author

E-Aho commented Jan 5, 2023

Pinging @pchtsp to check if there's any update on this PR :)

For reference, I've been using the change in this fork since raising the PR and it has been working fine

@@ -205,6 +205,7 @@ def __init__(
self.msg = msg
self.options = options
self.timeLimit = timeLimit
self.maxNodes = maxNodes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the comment two lines below says, the maxNodes attribute is stored inside the self.optionsDict attribute.

@@ -167,6 +170,8 @@ def solve_CBC(self, lp, use_mps=True):
cmds += f"mips {tmpMst} "
if self.timeLimit is not None:
cmds += f"sec {self.timeLimit} "
if self.maxNodes is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the other comment says, this attribute does not exist. You should thus do something like:

maxNodes = self.optionsDict.get("maxNodes")
if maxNodes is not None:
    cmds += f"maxNodes {maxNodes} "

@pchtsp
Copy link
Collaborator

pchtsp commented Oct 2, 2023

sorry for the troubles, I've added the maxNodes argument as explained in the comments #690. I'm closing the PR.

@pchtsp pchtsp closed this Oct 2, 2023
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