Marking optimization of deterministic timed weighted marked graphs