Solve problem with perfect weighted match in Pi criterion and minimice distance step also in Pi criterion.