epilepsy algorithm for therapy