Adaptive Inverse optimal neuromuscular electrical stimulation