Initial KR algorithm