Instead of calculating your costs ahead of time, use a dynamic priority queue to account for any externalities as they occur and then punish or reward those in the queue accordingly.
You can construct priority functions to work as a FIFO queue or a LIFO stack if you'd like as well.