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

Provide API to compute Lagrange multipliers #405

Open
waiyujack opened this issue Jul 26, 2021 · 5 comments
Open

Provide API to compute Lagrange multipliers #405

waiyujack opened this issue Jul 26, 2021 · 5 comments

Comments

@waiyujack
Copy link

I am using the package mainly via python API, I am wondering if there is a way I could get the Lagrangian multiplier from the auglag().

@stevengj
Copy link
Owner

No, the C API doesn't provide this.

Note that, given a local optimum (i.e. the NLopt result), you can easily compute Lagrange multipliers simply by solving a small least-squares problem. See e.g. https://discourse.julialang.org/t/lagrangian-function/38287/19?u=stevengj

@waiyujack
Copy link
Author

@stevengj Thank you for your answer!

When you mentioned local optimum, does the type of solver relevant here? Can it be a local optimum found by solvers (say MMA) other than the AUGLAG solver?

@stevengj
Copy link
Owner

The type of solver doesn't matter. For any solver that returns a local optimum, the KKT equations tell you how to compute Lagrange multipliers.

@stevengj stevengj changed the title Lagrangian multiplier from auglag Provide API to compute Lagrange multipliers Jul 30, 2021
@stevengj
Copy link
Owner

I've renamed this issue and marked it as an "enhancement", as it would be nice to have a built-in API for this.

@waiyujack
Copy link
Author

waiyujack commented Sep 14, 2021

@stevengj
Thanks for marking this as an "enhancement".

I have a quick question on lagrangian optimisation and hope you could share some insights.

Let's say we have a maximisation problem with one inequality constraint.

Instead of solving it as a constraint problem, is there any problem of solving this as a non-constraint problem (i.e. max objective_function + lambda * constraint_function)? We solve this multiple times with different lambda values and at the end pick a lambda that suits our needs?

The reason I asked this is because solving a non-constraint problem is usually much faster than a constraint problem.

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

No branches or pull requests

2 participants