Google : network simulator "eatmr" algorithm
.... there are several papers about EATMR.
An algorithm is mentioned for Matlab, not ns2
(please bear in mind that ns2 has been unsupported for years.)
Getting an existing algorithm / code : Write to authors and ask to buy the algorithm.
-