Skip to content
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

Introduce Constraints objects #38

Merged
merged 9 commits into from
Feb 20, 2018
Merged

Introduce Constraints objects #38

merged 9 commits into from
Feb 20, 2018

Conversation

anriseth
Copy link
Contributor

@anriseth anriseth commented Jan 25, 2018

This needs

  • Tests (may be some in IPNewtons we can use?)
  • A review to check whether all the code I put here is necessary

As a future PR, we should introduce value! et al. to the NDifferentiableConstraints objects as well. But let's deal with that after we have moved IPNewton into Optim.

  • Add Issue on value! et al. for Constraints

@codecov
Copy link

codecov bot commented Feb 16, 2018

Codecov Report

Merging #38 into master will increase coverage by 6.46%.
The diff coverage is 97.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   77.38%   83.84%   +6.46%     
==========================================
  Files           9       10       +1     
  Lines         199      291      +92     
==========================================
+ Hits          154      244      +90     
- Misses         45       47       +2
Impacted Files Coverage Δ
src/NLSolversBase.jl 100% <ø> (ø) ⬆️
src/interface.jl 81.63% <ø> (ø) ⬆️
src/objective_types/constraints.jl 97.82% <97.82%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e75b91...bfeb496. Read the comment docs.

@anriseth anriseth closed this Feb 18, 2018
@anriseth anriseth reopened this Feb 18, 2018
@anriseth
Copy link
Contributor Author

This is ready to go. Can someone review the changes, please?

@pkofod
Copy link
Member

pkofod commented Feb 20, 2018

Looks good. I'm wondering if we should simply use the existing NDifferentiable setup for the constraints, and have the constraints be a wrapper around an NDifferentiable and ConstraintsBounds? Would buy us AD, counters, etc automatically. We can always iterate on this in the future...

@pkofod pkofod merged commit d61033c into master Feb 20, 2018
Copy link
Member

@pkofod pkofod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pkofod pkofod deleted the constraints branch February 20, 2018 09:06
@anriseth
Copy link
Contributor Author

Looks good. I'm wondering if we should simply use the existing NDifferentiable setup for the constraints, and have the constraints be a wrapper around an NDifferentiable and ConstraintsBounds? Would buy us AD, counters, etc automatically. We can always iterate on this in the future...

Yes, if that's possible it will be very useful :)

@pkofod
Copy link
Member

pkofod commented Feb 20, 2018

I don't see why it wouldn't? Currently a constraint is simply a function and it's derivative + it's bounds. What I suggest is basically

struct Constraints{Td, Tb}
    c::Td
    b::Tb
end

where c is then either a NonDifferentiable, a OnceDifferentiable or a TwiceDifferentiable. This seems much simpler than "duplicating" these types with a Constraints suffix.

I know where this comes from, I just figured I'd mention it.

@pkofod
Copy link
Member

pkofod commented Feb 20, 2018

another relevant thing is to consider things like restricting parameters to a Ball for example. In https://github.com/cortner/ConstrainedOptim.jl we had a BallConstraint type used to project back into the ball.

@anriseth
Copy link
Contributor Author

Great, it seems like we can quickly improve the current interface then 👍

Ah, and BallConstraint projection works better than supplying a constraint c(x) = sum(abs2, x) with c(x) \leq C ?

@pkofod
Copy link
Member

pkofod commented Feb 20, 2018

Ah, and BallConstraint projection works better than supplying a constraint c(x) = sum(abs2, x) with c(x) \leq C ?

I guess it can be simpler in some cases, but "better" is sort of a multivalued thing here.

@longemen3000
Copy link
Contributor

adding to this, one problem is the existence of the second order differenciable constraints, because that hessian is not of any NDifferentiable type. as my current understanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants