Optimizing task assignment for collaborative computing over heterogeneous network devices