MATLAB: How do you find the lagrange multipliers

In summary, when solving a linear program using MATLAB's linprog function, the Lagrange multipliers for inequality and lower bound constraints can be found using lambda.ineqlin and lambda.lower respectively. However, for quadratic programs solved using MATLAB's quadprog function, the Lagrange multipliers can be obtained through [x,feval,exitflag,output,lambda]=quadprog(H,f,A,b,...). This may result in a list of matrix sizes instead of the Lagrange multipliers, which can be confusing. For further help, the link provided may be useful.
  • #1
math8
160
0
When I try to solve a linear program using matlab,after using linprog(f,A,b,...) I can find the Lagrange multiplier associated with the inequality constraints and the lower bound constraints by using:

lambda.ineqlin ; lambda.lower

But if I want to solve a quadratic program (using quadprog(H,f,A,b,...)), then how do I find the Lagrange multipliers?

I can see that to find the solution, you can use:
[x,feval,exitflag,output,lambda]=quadprog(H,f,A,b,...),

but the result for lambda, which I thought would give me the Lagrange multipliers, instead, itgives me a list of matrices sizes.

I don't understand that result for lambda.

How do I find the Lagrange multipliers for a quadratic program in Matlab?
 
Physics news on Phys.org
  • #2
Hey math8.

This might help:

http://www.mathworks.com.au/help/toolbox/optim/ug/brkvzon.html
 
Last edited by a moderator:
  • #3
Thanks!
 

1. How do I find the Lagrange multipliers in MATLAB?

To find the Lagrange multipliers in MATLAB, you can use the "fmincon" function which implements the constrained optimization algorithm. This function takes in the objective function, constraints, and initial values as inputs and returns the optimal values for the Lagrange multipliers.

2. What is the purpose of using Lagrange multipliers in MATLAB?

Lagrange multipliers are used in MATLAB to solve constrained optimization problems, where the objective function needs to be optimized subject to certain constraints. By using Lagrange multipliers, we can convert the constrained optimization problem into an unconstrained one, making it easier to solve using MATLAB's optimization functions.

3. How do I specify the constraints in MATLAB for finding Lagrange multipliers?

To specify constraints in MATLAB for finding Lagrange multipliers, you can use the "nonlcon" argument in the "fmincon" function. This argument takes in a function that defines the constraints and returns the value of the constraints at a given point. You can also specify linear constraints using the "A", "b", "Aeq", and "beq" arguments.

4. Can I use Lagrange multipliers in MATLAB for non-linear optimization problems?

Yes, you can use Lagrange multipliers in MATLAB for non-linear optimization problems. The "fmincon" function can handle both linear and non-linear constraints, making it suitable for a wide range of optimization problems. However, it is important to note that finding the optimal solution for non-linear problems can be more computationally intensive.

5. Are there any alternatives to using Lagrange multipliers in MATLAB for constrained optimization?

Yes, there are alternative methods for solving constrained optimization problems in MATLAB, such as the interior-point algorithm and the sequential quadratic programming (SQP) method. These methods may be more efficient for certain types of problems, so it is worth exploring and comparing different options to find the best solution for your specific problem.

Similar threads

  • Calculus and Beyond Homework Help
Replies
8
Views
456
  • Engineering and Comp Sci Homework Help
Replies
1
Views
819
  • Engineering and Comp Sci Homework Help
Replies
1
Views
834
  • Classical Physics
Replies
7
Views
866
  • Calculus and Beyond Homework Help
Replies
10
Views
306
Replies
13
Views
1K
Replies
25
Views
1K
  • Advanced Physics Homework Help
Replies
2
Views
817
Replies
3
Views
1K
  • Special and General Relativity
Replies
3
Views
2K
Back
Top