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

How can I get the information about the solving phase when solving the instance? #817

Open
hongxuanrui1999 opened this issue Mar 17, 2024 · 3 comments

Comments

@hongxuanrui1999
Copy link

I searched the document of the scip and found some information about the solving phase such as https://www.scipopt.org/doc-8.1.0/html/event__solvingphase_8c.php#a16d63e23b68a6d69d967a225693a3bd7. I want to get this information by pyscipopt. What do I need to add in scip.pyx and scip.pxd? Thank you very much!

@Joao-Dionisio
Copy link
Collaborator

Joao-Dionisio commented Mar 18, 2024

Hey @hongxuanrui1999! Oh man, I had no idea this existed. I don't know if this is supposed to be accessed only by SCIP, though. Just to make sure, you want the solving phase, not the solving stage, right?

To do this, I think you need to add the corresponding SCIP function to scip.pxd, and then call the function in scip.pxi. Something like this:

In scip.pxd

SCIP_BOOL transitionPhase3(SCIP * scip, SCIP_EVENTHANDLRDATA * eventhandlrdata) 

In scip.pxi

def checkTransitionPhase3(self, Eventhdlr eventhdlr): # I think the event handler needs to be an argument
    eventhdlr_data = SCIPeventhdlrGetData(eventhdlr)
    return transitionPhase3(self.scip, eventhdlr_data)

In the end, it's always nice if you include a test in the tests folder, to make sure the addition is working. And also add a line to CHANGELOG for record-keeping :)

@hongxuanrui1999
Copy link
Author

Thank you for your reply! Yes, I want to get the solving phase information instead of the solving stage information. How should I declare the SCIP_BOOL transitionPhase3 function in scip.pxd? It is not included in event_solvingphase. h.

@Joao-Dionisio
Copy link
Collaborator

Hey @hongxuanrui1999! This turned out to be a bit more complicated than I first thought. @mmghannam and I have been looking at it, and what you really want is the attribute solvingphase in eventhdlrdata. However, it's difficult to access this from the python side. transitionPhase3 just tells whether you are in phase 3 or not (but the same problems remain). We'll be working on it, as it's something useful.

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

No branches or pull requests

2 participants