|
|
Re: iteration of Lagarange optimization makes my code very slow
Posted:
Apr 20, 2011 8:47 AM
|
|
Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <00949645-8e90-476f-b720-57cbb13c752a@p6g2000vbn.googlegroups.com>... > On 20 Apr., 11:01, "Wenxu Li" <lwx...@gmail.com> wrote: > > Hello, > > > > I want to solve an optimization problem stated as follows: > > A(t)=a'*B(t)*a; the constraint is A(0)=1; > > where A(t) is a scalar at each time point t, a is a vector, B(t) is a square matrix, each element of B(t) is a function of t. > > > > I consider to use the Lagrange method to find the optimal A(t) over a period of time, e.g. from 0 to 300. I built the model as > > A(t)max=max{A(t)-lambda*(A(0)-1)}=max{a'*B(t)*a-lambda*(A(0)-1))}, > > which can be changed to a generalized eigenvalue problem as > > B(t)*a=lambda*A(0)*a, > > which can be further changed to a form > > A(0)^(-1/2)* B(t)*A(0)^(-1/2)*b=lambda*b; > > b=A(0)^(1/2)*a; > > However, in oder to get A(t) over a duration, i.e. 0 to 300, I calculated the largest eigenvalue and corresponding eigenvector at each time step, which is very time consuming. > > > > I am a new comer in this area, I could not find a more efficient way to solve the problem. Can someone suggest me a more efficient way to get A(t)? > > > > Many Thanks > > lee > > I'm sorry, but I can't understand your optimization problem. > > Maybe you mean > max: x'*B(t)*x > s.t. ||x|| = 1 > and you want to determine F with F(t)=x'*B(t)*x for the optimum x > vectors > over time ? > > Best wishes > Torsten. >
Hi, Torsten Thanks very for your reply. I am sorry that I did not explain this problem clearly. My aim is to find a maximum value of A(t)=a'*B(t)*a, in order to create a constraint to this optimization problem, I introduced A(0)=1. therefore, this problem will be finding a vector (a) which can give the maximum value of A(t) at each t . A(t)=a'*B(t)*a s.t. A(0)=1. here a is a vector which can be chosen arbitrarily and not limited to ||a||=1. Each element of B(t) has a form of constant*exp(constant*t+constant). B(t) is not a sparse matrix.
First, I tried to use eig() function to get an analytical form of the eigenvalues, and then I realized that it is difficult to get the analytical form and I cannot get the corresponding eigenvectors I want. Then I tried to use subs(B, t) to get B(t) for each time t and calculate the eigenvalues and eigenvectors, through this way I did find the maximum A(t) for each t, but the code is too slow. I tried eig() and eigs() functions, but the problems are unless I use loop for each t, I cannot get the analytical form of the largest eigenvalue and thus eigenvector.
|
|