Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<random>
- #include<chrono>
- #include<fstream>
- #include"opt_alg.h"
- #include"ode_solver.h"
- int main()
- {
- try
- {
- matrix x0(2), limits(2, 2);
- double epsilon = 1e-3;
- double h0;
- int Nmax = 5000;
- random_device R;
- limits(0, 0) = limits(1, 0) = -10;
- limits(1, 1) = limits(0, 1) = 10;
- x0(0) = (limits(0, 1) - limits(0, 0)) * R() / R.max() + limits(0, 0);
- x0(1) = (limits(1, 1) - limits(1, 0)) * R() / R.max() + limits(1, 0);
- h0 = 0.05;
- cout << "H0: " << h0 << endl << endl;
- solution opt_SD = SD(x0, h0, epsilon, Nmax, limits);
- cout << "opt_SD:" << opt_SD << endl;
- solution::clear_calls();
- solution opt_CG = CG(x0, h0, epsilon, Nmax, limits);
- cout << "opt_CG:" << opt_CG << endl;
- solution::clear_calls();
- solution opt_N = Newton(x0, h0, epsilon, Nmax, limits);
- cout << "opt_N:" << opt_N << endl;
- solution::clear_calls();
- }
- catch (char * EX_INFO)
- {
- cout << EX_INFO << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement