Skip edges with zero weight
This commit is contained in:
@@ -83,8 +83,12 @@ public class MaximumWeightBipartiteAuctionMatching<V, E> implements MatchingAlgo
|
|||||||
BigDecimal bestValue = BigDecimal.valueOf(-1.0);
|
BigDecimal bestValue = BigDecimal.valueOf(-1.0);
|
||||||
//find the item that offers the best value for this bidder
|
//find the item that offers the best value for this bidder
|
||||||
for (E edge: graph.edgesOf(bidder)) {
|
for (E edge: graph.edgesOf(bidder)) {
|
||||||
|
double weight = graph.getEdgeWeight(edge);
|
||||||
|
if(weight == 0.0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
V tmp = getItem(bidder, edge);
|
V tmp = getItem(bidder, edge);
|
||||||
BigDecimal value = BigDecimal.valueOf(graph.getEdgeWeight(edge)).subtract(prices.get(tmp));
|
BigDecimal value = BigDecimal.valueOf(weight).subtract(prices.get(tmp));
|
||||||
if (value.compareTo(bestValue) >= 0) {
|
if (value.compareTo(bestValue) >= 0) {
|
||||||
bestValue = value;
|
bestValue = value;
|
||||||
item = tmp;
|
item = tmp;
|
||||||
|
|||||||
Reference in New Issue
Block a user