Advertisement
Tvor0zhok

Untitled

May 24th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. @startuml
  2. TSPSolver <|-up- NNSolver
  3. Graph <-- NNSolver
  4.  
  5. TSPSolver <|-up- Ant
  6. Graph <-- Ant
  7.  
  8. TSPSolver <|-up- KOptSolver
  9. Graph <-- KOptSolver
  10.  
  11. TSPSolver <|-- ACOSolver
  12. Graph <-- ACOSolver
  13.  
  14. ACOSolver *-right- Ant
  15. ACOSolver o-- KOptSolver
  16.  
  17. abstract class TSPSolver {
  18. # vector<int> _solution :
  19. # int _len
  20. # int _n_cities
  21.  
  22. + {abstract} void print()
  23. + vector<int> solution()
  24. + int len()
  25. + bool operator < (TSPSolver& sol)
  26. }
  27.  
  28. class Graph {
  29. - int _N
  30. - vector<vector<int>> _adjMat
  31. + Graph()
  32. + Graph(string filePath)
  33. + int n()
  34. + vector<int>& operator[] (int i)
  35. }
  36.  
  37. class NNSolver {
  38. + void solve(Graph& g)
  39. + void print()
  40. }
  41.  
  42. class Ant {
  43. - next(vector<int>& visited, vector<int>& choices,
  44. vector<double>& weights)
  45. + Ant()
  46. + void solve(Graph& g, int s, vector<int>& visited,
  47. vector<int>& choices, vector<vector<double>>& weights)
  48. + void print()
  49. }
  50.  
  51. class ACOSolver {
  52. - string _type, _local_search_tours
  53. - double _alpha, _beta, _rho, _tau0,
  54. _tau_min, _tau_max, _a
  55. - int _n_ants, _max_iter,
  56. _n_jobs, _w, _k
  57. - vector<vector<double>> _tau,
  58. _eta_beta, _weights
  59. - vector<int> _vertices,
  60. _choices, _visited
  61. - vector<Ant> _ants
  62. - void elitist_ant_system(Graph& g)
  63. - rank_based_ant_system(Graph& g)
  64. - void max_min_ant_system(Graph& g)
  65. + ACOSolver(string type,
  66. map<string, any> params)
  67. + void solve(Graph& g)
  68. + void print()
  69. }
  70.  
  71. class KOptSolver {
  72. - string _type
  73. - void two_opt(Graph& g)
  74. - void two_half_opt(Graph& g)
  75. - void three_opt(Graph& g)
  76. + KOptSolver()
  77. + void solve(Graph& g, string type,
  78. vector<int> init_sol, int init_len)
  79. + void print()
  80. }
  81. @enduml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement