genetic algorithm (ga) + fmincon in an application of Vasicek model problem.
조회 수: 3 (최근 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!