scipopt/russcip

Add constraint to Model<Solved>

Closed this issue · 8 comments

egaban commented

I couldn't find in the documentation if there's a safe way to add a constraint after the model was solved

This could be useful for solving a TSP with lazy constraint generation, for instance

Hi @egaban, yes this is not allowed because SCIP doesn't allow you to create a constraint after the model is solved. However, to implement these lazy constraints, you would need to implement the Constraint handler plugin (like in here). This is unfortunately not yet implemented in russcip.

egaban commented

@mmghannam Thanks for the clarification. Would it be possible to implement that in my own code using traits, like described in the readme? If it works I could create a fork and open a PR to add that

That would be great @egaban, feel free to ask here or email me if you have any questions. Good luck, looking forward to your PR!

I think I was complicating it too much, an easier way would be to add access to the SCIP freeTransform method that would free the underlying SCIP transformed problem and would return russcip's Model to the ProblemCreated state where one could add more variables and constraints.

This sounds like a more tangible goal, @egaban are you still interested in working on this?

Hi @mmghannam! I apologize for not having enough time to work on that earlier, but I'm still interested in contributing.

The alternative approach you suggested sounds easier to implement, though the Constraint Handlers might be a more robust solution. Maybe we can do the freeTransform first.

I've started learning about Rust FFI, but the main challenge for the Constraint Handlers now is figuring out how to do that in SCIP's C interface (I've never done that in C before), and in a generic way (unknown ConsData type). I estimate that I'll be ready to start working on this in about a month, if that's ok.

No apologies needed! I'm happy to hear you're still interested. Let me know if I you need any help :)

@egaban This should be kind of solved with #129. I added another issue #130 for the constraint handler plugin to track it so let's continue the discussion there when you have time to work on it.

That's great! Thanks for the update