Optimal scheduling and control for constrained multi-agent networked control systems