Optimal Routing and Scheduling for Deterministic Delay Tolerant Networks