From 2e6ed67b92647bde0deceb2f1a2d2580382ea101 Mon Sep 17 00:00:00 2001 From: bbod Date: Mon, 30 Mar 2020 23:33:53 -0600 Subject: [PATCH] Auto Commit --- HW10/MakePermutationMatrix.cpp | 8 +++++--- HW10/input | 9 +-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/HW10/MakePermutationMatrix.cpp b/HW10/MakePermutationMatrix.cpp index ca1eb34..bb48c81 100644 --- a/HW10/MakePermutationMatrix.cpp +++ b/HW10/MakePermutationMatrix.cpp @@ -14,6 +14,7 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou std::sort(source.begin(), source.end()); std::vector myPerm = source; std::vector nextPerm = source; + auto lowest = INT_MAX; //return vector should be the size of number of processors as they are going to only return their own smallest. returnVector.resize(source.size(), 0); @@ -52,9 +53,10 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou cost += costMatrix[myPerm[i].GetName()][myPerm[i-1].GetName()]; } std::cout << std::endl << std::endl; - + if(cost < lowest) + lowest = cost; //Push permutation cost to the localCostVector. - localCostVector.push_back(cost); + //localCostVector.push_back(cost); } while (std::next_permutation(myPerm.begin(), myPerm.end()) && myPerm!=nextPerm); // //find the lowest and add it to a lowest vector. @@ -65,7 +67,7 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou // std::cout << lowest[0] << " "; // } - std::cout<< "Rank: "<< rank<< "cost count: "<< localCostVector.size() << std::endl; + std::cout<< "Rank: "<< rank<< "lowest cost: "<< lowest << std::endl; std::cout << "Rank: "<< rank <<" Last Perm: "; for(int i = 0; i < myPerm.size(); i++){ std::cout << myPerm[i].GetName() << " "; diff --git a/HW10/input b/HW10/input index e6700a0..a5fdb5e 100644 --- a/HW10/input +++ b/HW10/input @@ -5,11 +5,4 @@ 8 9 10 11 12 13 -14 15 -1 2 -3 4 -8 9 -10 11 -12 13 -14 15 -1 2 \ No newline at end of file +14 15 \ No newline at end of file