Abstract: A closed loop brain stimulation system includes a means for reading electrophysiological signals from the brain; means for reading other biometric signals; means for stimulating the brain; and a control algorithm that dynamically adjusts the parameters of stimulation to minimize a reference utility function that computes the difference between the current and desired brain states, and current and desired biometric states.