Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initUtilityConstraint()
- c = categories[1]
- me = attack_methods[1]
- t = teams[1]
- tuple = Simulate.cmt(c, me, t)
- w = windows[1]
- r = resources[1]
- wrtuple = Simulate.wr(w, r)
- for ni in 1:size(list,1), c in categories, f in **flights**
- performloop(ni, c, f, tuple, wrtuple)
- end
- end
- function performloop(ni, c, f, tuple, wrtuple)
- fi = findfirst(flights, f)
- for w in windows, me in attack_methods
- tuple.c = c
- tuple.m = me
- total = 0.0
- for t in teams
- tuple.t = t
- strat = linearizeStrategyS(f, c, t, w, ni)
- total = total + effectiveness[tuple]*strat
- end
- total = ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] )
- for w2 in owindows, r2 in resources
- wrtuple.w = w2
- wrtuple.r = r2
- over = linearizeOverflow(w2, r2, ni)
- total = total - resource_fines[wrtuple]*over
- end
- # println(string( sc[c], "<=", ( total*(flight_vals[fi]*(-1)) + flight_vals[fi] )))
- @addConstraint(m, sc[c] <= total)
- end
- end
- 1 item in flights array - performloop consumes about 620KB per iteration - peak memory consumption by program is 8.84GBs
- 2 items - 1.01MB per performloop iteration - peak 8.87GBs
- 3 items - 3.45MB - peak 9.60GBs
- 4 items - 4.35MB - peak 10.24GBs
- 5 items - 10.78MB - peak 15.63GBs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement