Got Questions? Get Answers.
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:
Quadratic Programming/Optimization

Subject: Quadratic Programming/Optimization

From: kamuran turksoy

Date: 21 Jul, 2011 22:30:13

Message: 1 of 7

Hi everyone

I have a function :

1/2*x'*H'x+b'*x+k

i want to find the x value which makes this function minimum with respect to A*x<c
In my inequality constraints i have rate and amplitude constraint for x
dxmin<dx<dxmax and xmin<x<xmax

For this problem i used matlab ''quadprog'' function but sometimes it gives wrong outputs,
for example in same case instead of giving xmin it gives higher values even sometimes xmax.

I also used fmincon to overcome this problem, but i could not.

Is there any other way to do it? Or any mistakes that i did?

Thank you

Subject: Quadratic Programming/Optimization

From: Torsten

Date: 22 Jul, 2011 07:10:45

Message: 2 of 7

On 22 Jul., 00:30, "kamuran turksoy" <kamuranturk...@gmail.com> wrote:
> Hi everyone
>
> I have a function :
>
> 1/2*x'*H'x+b'*x+k
>
> i want to find the x value which makes this function minimum with respect to A*x<c
> In my inequality constraints i have rate and amplitude constraint for x
> dxmin<dx<dxmax and xmin<x<xmax
>
> For this problem i used matlab ''quadprog'' function but sometimes it gives wrong outputs,
> for example in same case instead of giving xmin it gives higher values even sometimes xmax.
>
> I also used fmincon to overcome this problem, but i could not.
>
> Is there any other way to do it? Or any mistakes that i did?
>
> Thank you


Why do you think the result is incorrect if - according to your
settings -
x can vary between xmin and xmax ?

Best wishes
Torsten.

Subject: Quadratic Programming/Optimization

From: Rakesh Kumar

Date: 22 Jul, 2011 13:25:08

Message: 3 of 7

"kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message <j0a99l$c9r$1@newscl01ah.mathworks.com>...
> Hi everyone
>
> I have a function :
>
> 1/2*x'*H'x+b'*x+k
>
> i want to find the x value which makes this function minimum with respect to A*x<c
> In my inequality constraints i have rate and amplitude constraint for x
> dxmin<dx<dxmax and xmin<x<xmax
>
> For this problem i used matlab ''quadprog'' function but sometimes it gives wrong outputs,
> for example in same case instead of giving xmin it gives higher values even sometimes xmax.
>
> I also used fmincon to overcome this problem, but i could not.
>
> Is there any other way to do it? Or any mistakes that i did?
>
> Thank you

Remember that the solver is trying to minimize the quadratic function i.e.,
   minimize 1/2*x'*H'x+b'*x
where 'x' is the independent variable.

Your misunderstanding of the solution from quadprog seems to be
 minimize x
This is not correct.

I suggest you to understand optimization and in particular quadratic programming problem and solution from the doc. Here are two good references:
http://www.mathworks.com/help/toolbox/optim/ug/brg0p3g-1.html
http://www.mathworks.com/help/toolbox/optim/ug/brn4nlc.html

Hth,
Rakesh

Subject: Quadratic Programming/Optimization

From: Matt J

Date: 22 Jul, 2011 13:43:08

Message: 4 of 7

"kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message <j0a99l$c9r$1@newscl01ah.mathworks.com>...
> Hi everyone
>
> I have a function :
>
> 1/2*x'*H'x+b'*x+k
>
> i want to find the x value which makes this function minimum with respect to A*x<c
> In my inequality constraints i have rate and amplitude constraint for x
> dxmin<dx<dxmax and xmin<x<xmax

I'm assuming you really mean
 A*x<=c and xmin<=x<=xmax

If you're finding that x violates the bounds, it may be an error in the values of A. You would have to show us how you've generated A for us to know.

Regardless, though, you shouldn't be using inequality constraints A*x<=c to specify upper and lower bounds on x. You should be using the lb and ub arguments for that.

Subject: Quadratic Programming/Optimization

From: kamuran turksoy

Date: 22 Jul, 2011 22:23:09

Message: 5 of 7

"Matt J" wrote in message <j0bupc$p32$1@newscl01ah.mathworks.com>...
> "kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message <j0a99l$c9r$1@newscl01ah.mathworks.com>...
> > Hi everyone
> >
> > I have a function :
> >
> > 1/2*x'*H'x+b'*x+k
> >
> > i want to find the x value which makes this function minimum with respect to A*x<c
> > In my inequality constraints i have rate and amplitude constraint for x
> > dxmin<dx<dxmax and xmin<x<xmax
>
> I'm assuming you really mean
> A*x<=c and xmin<=x<=xmax
>
> If you're finding that x violates the bounds, it may be an error in the values of A. You would have to show us how you've generated A for us to know.
>
> Regardless, though, you shouldn't be using inequality constraints A*x<=c to specify upper and lower bounds on x. You should be using the lb and ub arguments for that.

Before optimization step, i use system identification toolbox and rarmax function to find my model coefficient. I just noticed model that i am getting from rarmax sometimes has poles out of unit circle which shows model unstable and i think this instability makes quadprog to give wrong result. So now i have to fix problem with rarmax. Is there any way to prevent rarmax gives model which is unstable?

Subject: Quadratic Programming/Optimization

From: Matt J

Date: 23 Jul, 2011 18:57:08

Message: 6 of 7

"kamuran turksoy" <kamuranturksoy@gmail.com> wrote in message <j0ct8d$r91$1@newscl01ah.mathworks.com>...
>
> Before optimization step, i use system identification toolbox and rarmax function to find my model coefficient. I just noticed model that i am getting from rarmax sometimes has poles out of unit circle which shows model unstable and i think this instability makes quadprog to give wrong result.
====================

That sounds unrelated to the problem you described. QUADPROG should always give a solution obeying the bounds.

Subject: Quadratic Programming/Optimization

From: Marcus M. Edvall

Date: 4 Aug, 2011 04:07:13

Message: 7 of 7

Try to use the optimization toolbox plug-in. All you have to do is
install TOMLAB - then you know if quadprog was the problem.

Best wishes, Marcus
http://tomopt.com/
http://tomdyn.com/

> Beforeoptimizationstep, i use system identification toolbox and rarmax function to find my model coefficient. I just noticed model that i am getting from rarmax sometimes has poles out of unit circle which shows model unstable and i think this instability makes quadprog to give wrong result. So now i have to fix problem with rarmax. Is there any way to prevent rarmax gives model which is unstable?

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