pav algorithm