Optimization.jl icon indicating copy to clipboard operation
Optimization.jl copied to clipboard

Arbitrary constraints

Open raphaelchinchilla opened this issue 4 years ago • 5 comments

Correct me if I am wrong, but it is not very clear in the documentation how would one go about defining constraints that are not "box" constraints. One of the keywords of OptimizationFunction is cons but it is not explained what is the syntax to define it. Is this feature implemented and the documentation is missing or the feature is not implemented yet?

Also, as of now, only ForwardDiff.jl can be use for constraints, is that correct?

raphaelchinchilla avatar Oct 19 '21 19:10 raphaelchinchilla

Is this feature implemented and the documentation is missing

~That's the case, you can refer to the tests for now if you have a use case.~

It is documented here https://galacticoptim.sciml.ai/stable/optimization_packages/optim/#Local-Constraint, examples with MOI are not included in the docs yet but it should work just like Optim wrapper.

Also, as of now, only ForwardDiff.jl can be use for constraints, is that correct?

Yes that's correct.

Vaibhavdixit02 avatar Oct 20 '21 04:10 Vaibhavdixit02

Thank you, I had not seen this example.

So, is I understand well, the keyword cons is the constraint function and lcons and ucons are the value of the bounds. I presume that if one wants an equality constraint, one sets lcons==ucons. Is this correct?

raphaelchinchilla avatar Oct 20 '21 05:10 raphaelchinchilla

No, a lot of optimizers won't like that. We need to add a thing for equality constraints and document this appropriately. It's just a work in progress.

ChrisRackauckas avatar Oct 20 '21 10:10 ChrisRackauckas

@ChrisRackauckas has the new version of GalacticOptim released today implemented equality constraints? Still not sure how to implement them besides setting lcons==ucons

raphaelchinchilla avatar Apr 28 '22 17:04 raphaelchinchilla

No @raphaelchinchilla not yet

Vaibhavdixit02 avatar Apr 28 '22 17:04 Vaibhavdixit02

This is done and documented.

ChrisRackauckas avatar Dec 12 '22 12:12 ChrisRackauckas