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

simultaneously evaluated objective and constraint #51

Closed
tpapp opened this issue May 5, 2021 · 3 comments
Closed

simultaneously evaluated objective and constraint #51

tpapp opened this issue May 5, 2021 · 3 comments

Comments

@tpapp
Copy link

tpapp commented May 5, 2021

Thanks for this great package, I find it very useful for structural estimation in macroeconomics.

A lot of problems I work with calculate the objective and the constraint simultaneously. Eg (stylized)

  1. given a set of structural parameters θ and prices p,
  2. agents solve their optimization problem to obtain an policy k = f(θ, p),
  3. mass distributions d = g(θ, p, k) are calculated, which is the most costly step, d is large
  4. the objective is a moment distance m(θ, p, d), while the constraint (market clearing) is c(θ, p, d) = 0.

Eg typically θ and p have a few ten-hundred elements, d thousands or millions.

Currently the way NLPModel and ADNLPModel are set up, f and g is evaluated twice. My understanding of augmented Lagrangian methods suggest that for an inner objective, they objective and the constrained are combined, so a function that returns both in a single pass could be used.

Sorry if this can be done in an obvious way with the current setup already, I could not figure it out.

@dpo
Copy link
Member

dpo commented May 5, 2021

The NLPModels API makes provisions for an objcons() method but it isn’t used in the current implementation of Percival. We’ll have to think how to work it in.

Sorry if this isn’t a permanent solution but for the time being, perhaps a simple caching mechanism could save you some computations?!

@tpapp
Copy link
Author

tpapp commented Jan 11, 2023

Where is objcons documented?

@tmigot
Copy link
Member

tmigot commented Jan 11, 2023

Hi @tpapp
objcons as well as all the functions used to access the NLPModel in general, are defined in NLPModels.jl. So, you can do:

using NLPModels
? objcons

or visit directly NLPModels.jl's doc

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

No branches or pull requests

3 participants