add PA learning algorithm two versions