From: Alborz on
I have problem in maximizing a simple quadratic function (by minimizing the negative of the function) subjected to an inequality constraint using FMINCON.
The solution provided by fmincon is an unconstrained solution.
Why does fmincon disregard the inequality constraint?
Here is the code:

Q = eye(2) ;

A_inequ = [ -.04 .30 ; 2.12 1.79 ] ;
B_inequ = .8 * ones( 2 , 1 ) ;

x0 = 0.01 * ones( 2 , 1 ) ;

[ x fval ] = fmincon( @(x) ( - x' * Q * x ) , x0 , A_inequ , B_inequ )


and the result is:

x =

1.0e+018 *

-3.0449
-0.4060


fval =

-9.4365e+036

By the way, the QUADPROG command did not work as well!!
From: John D'Errico on
"Alborz " <aeroalborz(a)gmail.com> wrote in message <hohe87$n1u$1(a)fred.mathworks.com>...
> I have problem in maximizing a simple quadratic function (by minimizing the negative of the function) subjected to an inequality constraint using FMINCON.
> The solution provided by fmincon is an unconstrained solution.
> Why does fmincon disregard the inequality constraint?
> Here is the code:
>
> Q = eye(2) ;
>
> A_inequ = [ -.04 .30 ; 2.12 1.79 ] ;
> B_inequ = .8 * ones( 2 , 1 ) ;
>
> x0 = 0.01 * ones( 2 , 1 ) ;
>
> [ x fval ] = fmincon( @(x) ( - x' * Q * x ) , x0 , A_inequ , B_inequ )
>
>
> and the result is:
>
> x =
>
> 1.0e+018 *
>
> -3.0449
> -0.4060
>
>
> fval =
>
> -9.4365e+036
>
> By the way, the QUADPROG command did not work as well!!

Yes. Of course, you do realize that this is a silly
thing to do?

You are trying to minimize the objective

-x^2 - y^2

therefore, maximize the function

x^2 + y^2

subject to inequality constraints. Since your objective
function is unbounded within the domain of your
constraint system, this will fail to yield anything of
value.

fmincon is not disregarding the inequality constraint.

Choose a well-posed problem, and you will find you get
reasonable results.

John
From: Alborz on
Thank you John for your instant reply. I appreciate that.
You are right. the question was as silly as hell!



"John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hohjg6$bog$1(a)fred.mathworks.com>...
> "Alborz " <aeroalborz(a)gmail.com> wrote in message <hohe87$n1u$1(a)fred.mathworks.com>...
> > I have problem in maximizing a simple quadratic function (by minimizing the negative of the function) subjected to an inequality constraint using FMINCON.
> > The solution provided by fmincon is an unconstrained solution.
> > Why does fmincon disregard the inequality constraint?
> > Here is the code:
> >
> > Q = eye(2) ;
> >
> > A_inequ = [ -.04 .30 ; 2.12 1.79 ] ;
> > B_inequ = .8 * ones( 2 , 1 ) ;
> >
> > x0 = 0.01 * ones( 2 , 1 ) ;
> >
> > [ x fval ] = fmincon( @(x) ( - x' * Q * x ) , x0 , A_inequ , B_inequ )
> >
> >
> > and the result is:
> >
> > x =
> >
> > 1.0e+018 *
> >
> > -3.0449
> > -0.4060
> >
> >
> > fval =
> >
> > -9.4365e+036
> >
> > By the way, the QUADPROG command did not work as well!!
>
> Yes. Of course, you do realize that this is a silly
> thing to do?
>
> You are trying to minimize the objective
>
> -x^2 - y^2
>
> therefore, maximize the function
>
> x^2 + y^2
>
> subject to inequality constraints. Since your objective
> function is unbounded within the domain of your
> constraint system, this will fail to yield anything of
> value.
>
> fmincon is not disregarding the inequality constraint.
>
> Choose a well-posed problem, and you will find you get
> reasonable results.
>
> John