Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2. int main()
  3. {
  4. int agents = 10;
  5.  
  6. Approximation app;
  7. Generator gen;
  8.  
  9. std::chrono::duration<double> start,
  10. stop,
  11. roznica_czasow,
  12. srednia;
  13.  
  14. std::vector<double> wektorCzasowy(7);
  15. std::vector<double> wektorAgentow(7);
  16.  
  17. //---------------------------testowanie-----------------------------------//
  18.  
  19. /**
  20. // Obliczanie czasu generowania macierzy
  21. calculateTimeOfGenerating(agents);
  22. */
  23.  
  24. // Obliczanie czasu obliczania macierzy dla różnych typów: Gauss, Gauss z optymalizacją i Gauss Seidel
  25. // s -> indexy kolejnych wyników
  26. for (int s = 0; s < 7; s++)
  27. {
  28. for (int j = 0; j < 3; j++)
  29. {
  30. SparseCalculateTimeOfExecutingCalculation(agents, wektorAgentow, wektorCzasowy, s);
  31. }
  32.  
  33. agents += 5;
  34. }
  35.  
  36. for (int p = 0; p < wektorCzasowy.size(); p ++)
  37. {
  38. std::cout << setprecision(12) << wektorCzasowy[p] << std::endl;
  39. }
  40.  
  41. // Błędy aproksymacji dla podanych danych
  42. std::vector<double> c = app.run(wektorAgentow, wektorCzasowy, 1);
  43.  
  44. double wynik = 0;
  45.  
  46. for(int i=0; i<c.size(); i++)
  47. {
  48. wynik += c[i] * pow(100000, i);
  49. }
  50.  
  51. for(int i = 0; i < c.size(); i++)
  52. {
  53. // Współczynniki
  54. cout << c[i] << " ";
  55. }
  56.  
  57. std::cout<<"Ilosc godzin: " << wynik/3600.0<<std::endl;
  58.  
  59. double wynikAprox = ApproximationError(wektorAgentow, wektorCzasowy, c);
  60. std::cout << wynikAprox << std::endl;
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement