Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1.  
  2. vector< vector<int> > makeMatrix(vector<EndP> end,int endNum , int num_caches, int num_videos)
  3. {
  4. //make matrix
  5.  
  6. vector< vector<int> > matrix;
  7. matrix.resize(num_videos);
  8. for(int i=0;i<num_videos;i++)
  9. {
  10. matrix[i].resize(num_caches);
  11. }
  12.  
  13. //clean matrix
  14. for(int i=0;i<num_videos;i++)
  15. {
  16. for(int j=0;j<num_caches;j++)
  17. {
  18. matrix[i][j]=0;
  19. }
  20. }
  21.  
  22. //fill matrix
  23. for(int i=0;i<endNum;i++)
  24. {
  25. for(auto& video: end[i].requests)
  26. {
  27. for(auto& cache: end[i].cLatency)
  28. {
  29. matrix[video.first][cache.first]+=(end[i].dLatency-cache.second)*(video.second);
  30. }
  31. }
  32. }
  33.  
  34. return matrix;
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement