genetic algorithm (ga) + fmincon in an application of Vasicek model problem.
1 次查看(过去 30 天)
显示 更早的评论
hi, i would apologize for my bad english.
My problem consist in finding the minimum in 5 variables of a 6 variables function, that rapresents the term structure of interest rates in the Vasicek model, with a nice approx.
I decided to apply GA to find a nice start point for fmincon (I use fmincon because I need to introduce constraints, the variables must be positive.)
function def: (R(0,Ti))
function f = sttdi(x)
%x(1)= gamma ; x(2)= rho ; x(3)= alfa ; x(4)= r0 ; x(5)= q
T=4;
f = x(1)+((x(2)*x(5))/x(3))-((1/2)*((x(2)^2)/x(3)))+(x(4)-(x(1)+((x(2)*x(5)/x(3))-((1/2)*((x(2)^2)/x(3))))))*(1/(x(3)*T))*(1-(exp(-x(3)*T)))+(x(2)^2/4*x(3)^3*T)*((1-(exp(-x(3)*T)))^2);
A = [-1 0 0 0 0 ; 0 -1 0 0 0 ; 0 0 -1 0 0 ; 0 0 0 -1 0 ; 0 0 0 0 -1 ];
b = [0 0 0 0 0 ];
Now from command window :
>> x=ga(@rel1,5,A,b)
Optimization terminated: maximum number of generations exceeded.
x =
3.0140 8.4916 0.0000 1.3246 9.5596
>> options=optimset('Algorithm', 'sqp')
>> [x,fval]=fmincon(@rel1,x,A,b,[],[],[],[],[],options)
Problem appears unbounded.
fmincon stopped because the objective function value is less than
the default value of the objective function limit and constraints
are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
1.0e+013 *
0.0000 0.4439 0.0000 0.0000 3.5294
fval =
-6.3969e+040
I can not understand the output, as can be x (3) = 0 if it appears in the denominator? I'm doing the conceptual errors?
Thanks guys
0 个评论
采纳的回答
Walter Roberson
2011-9-21
Before you run the problem, command
format long g
and then run it.
You will likely see that your x values are non-zero.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!