-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ENH: adds constraints for differential evolution #10002
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
Conversation
TODO:
This is solved by concatenating constraint violations for each constraint. |
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.
Some minor notes about docstrings.
CI failure is a timeout. |
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.
Some of the CI failures seem related to me?
Also, can you please mark the resolved conversations / revisions appropriately so it is easier to see what still needs doing?
@tylerjereddy, there were a couple of method calls that needed to be renamed after #9990 got merged. I've marked conversations that have been addressed as resolved (which is all of them). |
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.
- would be nice if an
optimize
guru signs off--I see @mdhaber has been pinged on that - that said, no old tests have been modified, so that's good behavior-wise, and CI is passing now
- coverage on new code looks pretty solid too
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.
I'm afraid I'm not too much help here! I suppose I would just agree with @tylerjereddy's comments about the tests. And beyond hitting missed lines, a few more end to end solve()
tests with constrained problems would be good, especially in the absence of thorough domain-expert review. Maybe test with multiple constraint types, LinearConstraint
, at least one other objective function, etc... I can't see why they wouldn't play nice with one another, but I think it's important to test anyway.
I'm not going to be able to make any changes until next Monday, perhaps the milestone needs to be bumped. |
I'll bump it, but let's get this in soon--my review notes show very few reasons not to merge at this point apart from not having an expert sign off on review. |
@mdhaber, perhaps add a few - at least one LinearConstraint in the tests, and a different example in the docstring? |
@andyfaff submitted PR to your fork. Is that the best way to do this? |
Probably going to want to reformat most of these as benchmarks. There are at least two, though, that are fast enough to be tests. |
@mdhaber made some comments on your PR. For the additions to be scipy tests they shouldn't take more than about ~10s, a couple of minutes is too long. A lot of the test tolerances are set quite loosely, and I'm surprised that
and
|
It may be just as well the PR wasn't merged for 1.3.0. I've just figured out a large slowdown in the constraints implementation, when There are a few ways around this:
I think option 1 is cleanest. In fact it may be cleanest to write a private version |
Use of
|
I was wondering whether that was happening because occasionally I'd get notifications that a LinearConstraint would be more appropriate if the Jacobian is constant. Nice find. That should really speed things up! |
I've tidied up the commit history, this PR needed squashing. I think it's in a position to merge. |
Restarted test with build failure. |
Sorry, the individual commits were lost when I squashed in preparation for a merge. Test changes
differential_evolution code
|
I haven't forgotten! I'll try to get to this soon. |
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.
I didn't look much at the recent changes, but I tested them. As you mentioned, it's much faster without the unnecessary Jacobian evaluations and the accuracy is great when forced to iterate longer than the default. Based on the performance and earlier code review, I'm pretty confident that this is implementing the algorithm as intended.
If this passes now I think it's good to go. |
We're all good now. The pypy3 test fail can be ignored. |
@mdhaber, could we merge this? |
@mdhaber thanks for your sterling review and test development work on this. |
NP and thanks for the PR. In the past, I've only used local minimizers for nonlinear problems (mostly optimal control), so it was great to play around with DE for the first time. I was impressed! |
Adds constraints for
differential_evolution
following LampinenDepends on #9990 being merged first.
The first commit adds the machinery, tests are being created.