Test simpler source/target differentiation
This commit is contained in:
@@ -18,6 +18,7 @@ public class MaximumWeightBipartiteAuctionMatching<V, E> implements MatchingAlgo
|
||||
private final BigDecimal delta;
|
||||
private final Set<E> matching;
|
||||
private final BigDecimal matchingWeight;
|
||||
private boolean swappedPartitions = false;
|
||||
|
||||
public MaximumWeightBipartiteAuctionMatching(Graph<V, E> graph, Set<V> partition1, Set<V> partition2) {
|
||||
this.graph = GraphTests.requireUndirected(graph);
|
||||
@@ -58,6 +59,7 @@ public class MaximumWeightBipartiteAuctionMatching<V, E> implements MatchingAlgo
|
||||
else {
|
||||
bidders = partition2;
|
||||
items = partition1;
|
||||
swappedPartitions = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -124,12 +126,18 @@ public class MaximumWeightBipartiteAuctionMatching<V, E> implements MatchingAlgo
|
||||
which will be the "target", so I'm using this function to make sure I get the right one.
|
||||
*/
|
||||
private V getItem(V bidder, E edge) {
|
||||
if (graph.getEdgeSource(edge).equals(bidder)) {
|
||||
return graph.getEdgeTarget(edge);
|
||||
}
|
||||
else {
|
||||
if (swappedPartitions) {
|
||||
return graph.getEdgeSource(edge);
|
||||
}
|
||||
else {
|
||||
return graph.getEdgeTarget(edge);
|
||||
}
|
||||
// if (graph.getEdgeSource(edge).equals(bidder)) {
|
||||
// return graph.getEdgeTarget(edge);
|
||||
// }
|
||||
// else {
|
||||
// return graph.getEdgeSource(edge);
|
||||
// }
|
||||
}
|
||||
|
||||
public BigDecimal getMatchingWeight() {
|
||||
|
||||
Reference in New Issue
Block a user