Comment out old MWM algorithm, add auction algorithm

This commit is contained in:
eugenefischer
2022-10-14 17:38:07 -05:00
parent 5f0c089b0a
commit f7d522e95d

View File

@@ -185,28 +185,32 @@ public class Simulator implements GraphModificationFunctions {
//Find Maximum Weight Matching //Find Maximum Weight Matching
//using jheaps library class PairingHeap for improved efficiency //using jheaps library class PairingHeap for improved efficiency
if(verbose){System.out.println("Finding maximum weight matching");} if(verbose){System.out.println("Finding maximum weight matching");}
MaximumWeightBipartiteMatching maxWeightMatching;
//Use correct heap type for priority queue //NON-AUCTION ALGORITHM
String heapType = BiGpairSEQ.getPriorityQueueHeapType(); // MaximumWeightBipartiteMatching maxWeightMatching;
switch (heapType) { // //Use correct heap type for priority queue
case "PAIRING" -> { // String heapType = BiGpairSEQ.getPriorityQueueHeapType();
maxWeightMatching = new MaximumWeightBipartiteMatching(graph, // switch (heapType) {
alphas, // case "PAIRING" -> {
betas, // maxWeightMatching = new MaximumWeightBipartiteMatching(graph,
i -> new PairingHeap(Comparator.naturalOrder())); // alphas,
} // betas,
case "FIBONACCI" -> { // i -> new PairingHeap(Comparator.naturalOrder()));
maxWeightMatching = new MaximumWeightBipartiteMatching(graph, // }
alphas, // case "FIBONACCI" -> {
betas, // maxWeightMatching = new MaximumWeightBipartiteMatching(graph,
i -> new FibonacciHeap(Comparator.naturalOrder())); // alphas,
} // betas,
default -> { // i -> new FibonacciHeap(Comparator.naturalOrder()));
maxWeightMatching = new MaximumWeightBipartiteMatching(graph, // }
alphas, // default -> {
betas); // maxWeightMatching = new MaximumWeightBipartiteMatching(graph,
} // alphas,
} // betas);
// }
// }
//Auction algorithm version
MaximumWeightBipartiteAuctionMatching maxWeightMatching = new MaximumWeightBipartiteAuctionMatching(graph, alphas, betas);
//get the matching //get the matching
MatchingAlgorithm.Matching<String, DefaultWeightedEdge> graphMatching = maxWeightMatching.getMatching(); MatchingAlgorithm.Matching<String, DefaultWeightedEdge> graphMatching = maxWeightMatching.getMatching();
if(verbose){System.out.println("Matching completed");} if(verbose){System.out.println("Matching completed");}
@@ -267,7 +271,8 @@ public class Simulator implements GraphModificationFunctions {
} }
//Metadata comments for CSV file //Metadata comments for CSV file
String algoType = "LEDA book with heap: " + heapType; // String algoType = "LEDA book with heap: " + heapType;
String algoType = "Basic Auction Algorithm";
int min = Math.min(graphAlphaCount, graphBetaCount); int min = Math.min(graphAlphaCount, graphBetaCount);
//matching weight //matching weight
BigDecimal totalMatchingWeight = maxWeightMatching.getMatchingWeight(); BigDecimal totalMatchingWeight = maxWeightMatching.getMatchingWeight();