Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Objective function or lagrangian gradient input to fmincon?

Subject: Objective function or lagrangian gradient input to fmincon?

From: George

Date: 21 Jan, 2013 00:54:08

Message: 1 of 3

Hello,

It is not clear from the help files whether the gradient that fmincon accepts should be the gradient of the objective function or of the lagrangian.

This page (fmincon help):
http://www.mathworks.com/help/optim/ug/fmincon.html#f186882
makes it clear in the "Hessian" section that the hessian fmincon accepts is the hessian of the lagrangian.

But the description of the inputs seems to imply that the gradient supplied is of just the objective function, not the lagrangian: "[x,fval,exitflag,output,lambda,grad] = fmincon(...) returns the value of the gradient of fun at the solution x."

So, the gradient doesn't need to be of the lagrangian; just the objective function?

Thanks!

Subject: Objective function or lagrangian gradient input to fmincon?

From: Bruno Luong

Date: 21 Jan, 2013 07:17:08

Message: 2 of 3

"George Shoukry" wrote in message <kdi3jg$bte$1@newscl01ah.mathworks.com>...
> So, the gradient doesn't need to be of the lagrangian; just the objective function?
>

Simple and logical:

The gradient implemented of the objective function for must be the objective function alone. The gradient implemented of the constraint function for must be the constraint function alone.

Bruno

Subject: Objective function or lagrangian gradient input to fmincon?

From: Alan_Weiss

Date: 21 Jan, 2013 15:58:47

Message: 3 of 3

On 1/21/2013 2:17 AM, Bruno Luong wrote:
> "George Shoukry" wrote in message
> <kdi3jg$bte$1@newscl01ah.mathworks.com>...
>> So, the gradient doesn't need to be of the lagrangian; just the
>> objective function?
>>
>
> Simple and logical:
>
> The gradient implemented of the objective function for must be the
> objective function alone. The gradient implemented of the constraint
> function for must be the constraint function alone.
> Bruno

To add to what Bruno said, you could check the documentation for
objectives and constraints:
http://www.mathworks.com/help/optim/ug/writing-objective-functions.html#bsj1e55
http://www.mathworks.com/help/optim/ug/writing-constraints.html#brhkghv-16

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us