Proposition of overall algorithm