Minumum cost maximum flow modeling.