exchange function added in np_scheduler.py