Weighted matching problem