// 2, 0: -23.0 *** Cost: -16.0, Matching: (0, 2), (1, 3),
// 2, 1: -49.0 *** Cost: -46.0, Matching: (0, 2), (1, 0),
// 2, 2: -32.0 *** Cost: -25.0, Matching: (0, 1), (1, 0),
// 2, 3: -49.0 *** Cost: -46.0, Matching: (0, 2), (1, 0),
BipartiteCavityMatcher matcher = new UnorderedBipartiteCavityMatcherMinCostFlow(
3, 4);
matcher.setAllMatchCost(0, -4, -3, -20, -2);
matcher.setAllMatchCost(1, -30, -4, -4, -4);
matcher.setAllMatchCost(2, -4, 4, 4, 4);
matcher.setAllDelCostX(5, 5, 2);
matcher.setAllDelCostY(5, 1, 5, 1);
checkCavityMatchings(matcher);
// check forced matchings:
double inf = Double.POSITIVE_INFINITY;
matcher.setDelCostX(0, inf);
matcher.setDelCostY(2, inf);
System.out.println("\n");
System.out.println("Checking forced match of x0 and y2: ");
checkCavityMatchings(matcher);
matcher.setDelCostY(2, 5);
matcher.setDelCostY(0, inf);
System.out.println("\n");
System.out.println("Checking forced match of x0 and y0: ");
checkCavityMatchings(matcher);
matcher.setDelCostX(0, 5);
matcher.setDelCostY(0, 5);
System.out.println("\n");
System.out.println("Checking forced match of x2: ");
matcher.setDelCostX(2, inf);
checkCavityMatchings(matcher);
System.out.println("\n");
System.out.println("Checking group replacement: ");
matcher = new UnorderedBipartiteCavityMatcherMinCostFlow(4, 3);
matcher.setAllMatchCost(0, -4, -30, -4);
matcher.setAllMatchCost(1, -3, -4, 4);
matcher.setAllMatchCost(2, -20, -4, 4);
matcher.setAllMatchCost(3, -2, -4, 4);
matcher.setAllDelCostX(5, 1, 5, 1);
matcher.setAllDelCostY(5, 5, 2);
checkCavityMatchings(matcher);
}