Algorithm MinCuts optimization.