PySCIPOpt icon indicating copy to clipboard operation
PySCIPOpt copied to clipboard

Column Generation example in PySCIPOpt

Open belzebuu opened this issue 6 years ago • 2 comments

Hi,

I would like to implement a column generation approach in PySCIPOpt for teaching purposes.

I have seen from tests/test_pricer.py that it is possible to use the callback function includePricer(). But I would like the students to work on a lower level to understand better the technique.

I would like to follow the approach of: examples/unfinished/cutstock.py

However, I understood that relax() and column() are not available/implemented yet.

I could resort to reimplementing from scratch the restricted master problem every time a new variable is added. Thus no warm restart.

Is there another way I could mimic at this stage the implementation of cutstock.py. For example using addConstrCoeff()??

Thank you! Best regards, Marco

belzebuu avatar May 21 '19 16:05 belzebuu

sorry we never replied. is this still relevant?

fserra avatar May 28 '20 19:05 fserra

Yes 😊

-- Marco Chiarandini, Asc. Prof. Department of Mathematics and Computer Science, University of Southern Denmark, Campusvej 55, DK-5230 Odense M, Denmark. Phone: +45 6550 4031 [email protected]mailto:[email protected], http://www.imada.sdu.dk/~marco

From: fserra [email protected] Reply to: SCIP-Interfaces/PySCIPOpt [email protected] Date: Thursday, 28. May 2020 at 21:11 To: SCIP-Interfaces/PySCIPOpt [email protected] Cc: Marco Chiarandini [email protected], Author [email protected] Subject: Re: [SCIP-Interfaces/PySCIPOpt] Column Generation example in PySCIPOpt (#281)

sorry we never replied. is this still relevant?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SCIP-Interfaces/PySCIPOpt/issues/281#issuecomment-635541438, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADDRXCHLPT3OOBJ5YHPRVLTRT2ZPHANCNFSM4HOMQPBA.

belzebuu avatar May 28 '20 23:05 belzebuu

Hey @belzebuu :) I don't know if the code is still useful for you, but I think I did what you wanted.

Here is the code: cutstock.zip

Let me know what you think!

Joao-Dionisio avatar Oct 01 '22 19:10 Joao-Dionisio

Dear @Joao-Dionisio,

yes! this is what I wanted. It will be useful for my teaching purposes.

I have read the discussion around the workaround on line 48. Maybe if you publish this example under the finished ones, you could avoid redefining y below on line 73, as it maybe confusing.

I will then reconsider pyscipopt for the new term! Thanks a lot for keeping this in mind!

belzebuu avatar Oct 02 '22 11:10 belzebuu

I'm very glad I could help @belzebuu , I hope your students end up liking pyscipopt!

As for publishing the code, it is not in SCIP's philosophy to use it as a black box solver. The proper way would be to use a pricer as you first mentioned. If it interests you, you can read the discussion on Pull Request #617 . Thank you for the recommendation on the y variables, though, you're absolutely right.

Good luck for the new term!

Joao-Dionisio avatar Oct 02 '22 12:10 Joao-Dionisio

Thank you @Joao-Dionisio for making me aware of that discussion. Yes, it is of interest for me. I have checked test_pricer and took note that, that is the "SCIP way". I am not so familiar with SCIP after all. I agree that in test_pricer there is more emphasis on the LP vs SCIP distinction and that it is for this reason instructive. What I fear might be more problematic to teach is the inheritance from the class Pricer. I will give it some more thoughts but nice to have now both possibilities.

belzebuu avatar Oct 02 '22 23:10 belzebuu