Conversation
Doesn't this seem like a big deal? If modifying the This seems like an abstraction problem to have to add to MOI if it is only used in Couldn't ECOS just hold a pointer to |
Yes, no big deal at all. That's my point, we don't lose much.
MatrixOfConstraints does not allow modification. However, one could do: MOI.copy_to(optimizer, model)
MOI.empty!(model)
MOI.optimize!(optimizer)But we don't want to complicate everything for this use case since the only use case we care about it the use when |
|
Okay, I'd approve merging this for now, but we'd need to see ECOS et al working before tagging MOI 0.10. Or at least, say in the docstring that this is experimental, and solvers relying on it should be careful. I guess it's okay to break some things post MOI 0.10 so long as we are the only ones using it. |
|
Sounds good, good to merge with the last commit ? |
I've just refactored ECOS with MatrixOfConstraints (jump-dev/ECOS.jl#121).
There is something tricky that will also be problematic for other similar solvers.
When you implement
copy_to!(dest::Optimizer, src::OptimizerCache),srccontains exactly the data you need to call the solver directly. However, you cannot call it yet, you need to wait foroptimize!to be called.So you need to store a cache
srcindest. You need to store a copy sincesrccould be modified or its data could be free'd beforeoptimize!is called.This create a lot of edge cases that kind of defeat the purpose of #1381 to remove the need for the optimizer to have a cache as this is handled by the
CachingOptimizer.This PR defines a one-shot optimization function that both gives
srcand optimizes.For one-shot solver such as most conic solvers, this will considerably simplify the MOI wrapper. It would prevent using these wrapper with
copy_toandoptimize!separately without any other MOI layer but it does not matter much.99% of the use cases would be using it with JuMP or with
MOI.instantiatewith bridges which would add a CachingOptimizer layer anyone.So there shouldn't be much difference for the user. It would just simplify a lot the writing of these solvers. No need to complicate it to cover the case where
srcis modified between copy and optimizer while we know this will almost only be used by the CachingOptimizer'soptimize!method which just calls optimize directly after the copy.The docstring might be clarified to insist that this is a very particular use case. We could even move the function in
MOI.Utilitiesif that would clarify it.