Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. function initUtilityConstraint()
  2. c = categories[1]
  3. me = attack_methods[1]
  4. t = teams[1]
  5. tuple = Simulate.cmt(c, me, t)
  6. w = windows[1]
  7. r = resources[1]
  8. wrtuple = Simulate.wr(w, r)
  9. for ni in 1:size(list,1), c in categories, f in **flights**
  10. performloop(ni, c, f, tuple, wrtuple)
  11. end
  12. end
  13.  
  14. function performloop(ni, c, f, tuple, wrtuple)
  15. fi = findfirst(flights, f)
  16. for w in windows, me in attack_methods
  17. tuple.c = c
  18. tuple.m = me
  19. total = 0.0
  20. for t in teams
  21. tuple.t = t
  22. strat = linearizeStrategyS(f, c, t, w, ni)
  23. total = total + effectiveness[tuple]*strat
  24. end
  25.  
  26. total = ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] )
  27.  
  28. for w2 in owindows, r2 in resources
  29. wrtuple.w = w2
  30. wrtuple.r = r2
  31. over = linearizeOverflow(w2, r2, ni)
  32. total = total - resource_fines[wrtuple]*over
  33. end
  34. # println(string( sc[c], "<=", ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] )))
  35. @addConstraint(m, sc[c] <= total)
  36. end
  37. end
  38.  
  39. 1 item in flights array - performloop consumes about 620KB per iteration - peak memory consumption by program is 8.84GBs
  40. 2 items - 1.01MB per performloop iteration - peak 8.87GBs
  41. 3 items - 3.45MB - peak 9.60GBs
  42. 4 items - 4.35MB - peak 10.24GBs
  43. 5 items - 10.78MB - peak 15.63GBs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement