wnowak8

HJ

Nov 18th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. solution HJ(matrix x0, double s, double alfa, double epsilon, int Nmax, matrix O)
  2. {
  3. solution XB, XB_old, X;
  4. XB.x = x0(0) ;
  5. XB.fit_fun();
  6. int i;
  7. while (true)
  8. {
  9.  
  10. X = HJ_trial(XB.x, s );
  11. if (X.y< XB.y)
  12. {
  13. while (true)
  14. {
  15. i = 0;
  16. XB_old.x = XB.x ;
  17. XB.x = X.x ;
  18. X.x = 2*XB.x- XB_old.x;
  19. X.fit_fun();
  20. X = HJ_trial(X.x , s );
  21. if (i=Nmax)
  22. break;
  23. if (X.y>=XB.y )
  24. return XB;
  25. }
  26. }
  27. else
  28. s *= alfa;
  29. if (s<epsilon )
  30. return XB;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment