Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- solution HJ(matrix x0, double s, double alfa, double epsilon, int Nmax, matrix O)
- {
- solution XB, XB_old, X;
- XB.x = x0(0) ;
- XB.fit_fun();
- int i;
- while (true)
- {
- X = HJ_trial(XB.x, s );
- if (X.y< XB.y)
- {
- while (true)
- {
- i = 0;
- XB_old.x = XB.x ;
- XB.x = X.x ;
- X.x = 2*XB.x- XB_old.x;
- X.fit_fun();
- X = HJ_trial(X.x , s );
- if (i=Nmax)
- break;
- if (X.y>=XB.y )
- return XB;
- }
- }
- else
- s *= alfa;
- if (s<epsilon )
- return XB;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment