|
Hi Paul,
Thanks a lot for your help! They are really useful. As you
suggested, I set x0 = [1;1;0;0;0;0;0;0;0;0] as my initial
guess and it worked!
Thanks again for your help!
Best Regards,
Xiaolu
"Paul Kerr-Delworth" <Paul.Kerr-Delworth@mathworks.co.uk>
wrote in message <g95s1b$4q9$1@fred.mathworks.com>...
> Hi Xiaolu,
>
> The message that you receive from fmincon indicates that
fmincon has not
> been able to find a solution that satisfies all the
constraints in your
> problem. This can mean one of two things, either
>
> 1) There are no feasible solutions in the problem
> 2) There are feasible solutions, but fmincon has not been
able to find any
>
> Given the constraints you state, I think case 2) applies.
It often helps if
> you provide an initial point, X0, which is feasible. With
the constraints
> you state below, you could use X0 = [1 1 0 ... 0] as a
feasible initial
> point.
>
> However, I've noticed a couple of extra things here. It
looks like you are
> trying to maximize (x' * rtn - (1/2) * x' * sigma * x)
and you are doing
> that by minimizing (x' * rtn - (1/2) * x' *
> > sigma * x)^(-1). You say that this is the same thing,
and I think it is
> > not necessarily the same. You should minimize -(x' *
rtn - (1/2) * x' *
> > sigma * x), which is equivalent to the maximization you
require. At the
> > end of this post is a simple example which illustrates
that max f(x) is
> > not necessarily the same as min (1/f(x)).
>
> Also, is there another way of writing the sum(abs(x)) = 2
constraint? If you
> can replace it by a linear constraint or set of linear
constraints in some
> way, then you could use the function, quadprog, which is
better suited to
> quadratic problems.
>
> Hope this helps.
>
> Best regards,
>
> Paul
>
> p.s. Consider maximizing a simpler function, f(x) =
5*x*exp(-x) -1 over the
> range [0.2, 1.4]. This has a maximum at x = 1.
>
> f = @(x) 5*x.*exp(-x) - 1;
> x = 0.2:0.01:1.4;
> plot(x, f(x));
>
> Now try minimize the function 1/f(x) over the same
interval. This function
> is in fact unbounded in the range [0.2, 1.4], it tends to
minus infinity at
> approximately x = 0.26
>
> hold on
> plot(x, 1./f(x), 'r');
>
> Minimizing 1/f(x) in this case will not necessarily give
the same answer as
> max f(x).
>
> "Xiaolu Wang" <wangxiaolu83@yahoo.com.cn> wrote in
message
> news:g94oet$qdq$1@fred.mathworks.com...
> > I've been working on optimizing some utility function
under
> > constraint by fmincon(). But the result doesn't make any
> > sense and there's something saying :
> >
> > Optimization terminated: no feasible solution found.
> > Magnitude of search direction less than 2*options.TolX
but
> > constraints are not satisfied.
> >
> > Does anyone know why this happens and how to get rid of
it?
> >
> > the utility function I'm working on is:
> > (x' * rtn - (1/2) * x' * sigma * x)
> > where rtn is a vector of expected return of assets and
> > sigma is the covariance matrix of assets. In order to
> > optimize it, I use fmincon() on (x' * rtn - (1/2) * x' *
> > sigma * x)^(-1), which is the same thing.
> >
> >
> > the constraints are:
> > ones(N,1)'*x = 0;
> > -ones(N,1)<x<ones(N,1);
> > sum(abs(x)) = 2.
> >
> > many thanks
> >
>
>
|