-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: add support for setting initial solutions with cbc #71
Conversation
Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
The design seems good to me |
Awesome! Now I just have to find out why the problem in the test has no solution the second time I compute it |
I just simplified the test a lot and that fixed it. I am not sure if there is still something wrong now? @lovasoa do you think we now need a more ergonomic way to construct |
It’s an important case I think. In my usecase, I have a solution that I know is feasible and good quality. |
The same is true for me. The question remains if we need a more ergonomic API to construct a solution. Maybe not, because we're going to have a way to give an initial value to each variable? I'm undecided on this so far |
Yes, I think we need a way to build solutions for this to be helpful. Maybe implement |
@lovasoa do you want this done in this PR? If no, what else is needed before this can be merged? |
Yes, I think the feature is not very useful without this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great ! I think we should accept an iterator instead of a vec, and then we are good to merge 👍
Nice, will do! I can imagine that setting each variable individually is not as good as setting the entire solution at once if one has a full solution available. Should we still have a way to set complete initial solutions? I honestly don't really see how that would be useful because I don't see a way to construct these solutions, but I just wanted to make sure we're on the same page with this:) |
The current implementation looks good to me. I'll merge it as soon as you make the fix. |
If we could modify a model, it could be useful to use the solution. An example is lexicographic objectives:
But, as far as I remember, the current interface doesn’t allow this. |
I agree. I would also like to be able to modify problems and then reuse previous solutions from previous runs. But this is out of scope for the current PR. I might look into this in the future. |
🚀 |
This is a first attempt at adding support for initial solutions. For now, only coin_cbc is supported. Compatibility with more solvers can be added in subsequent pull requests.
For some reason, the added test still fails. It's probably a dumb oversight, but until somebody spots it, I would be happy to receive feedback on whether the API and implementation of this feature go in the right direction. If you have complaints about the naming (should we rename
set_initial_solution
toinitial_solution
orinitial
orinitialize
orinit
orset_initial
orwith_initial_solution
?), please let me know and I'll change it.Towards #55.