From 756e854b7bf7ba8a8661bb328fa89734c6116262 Mon Sep 17 00:00:00 2001 From: bbod Date: Mon, 30 Mar 2020 19:11:07 -0600 Subject: [PATCH] Auto Commit --- HW10/MakePermutationMatrix.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/HW10/MakePermutationMatrix.cpp b/HW10/MakePermutationMatrix.cpp index 2eac976..09c1df9 100644 --- a/HW10/MakePermutationMatrix.cpp +++ b/HW10/MakePermutationMatrix.cpp @@ -20,10 +20,10 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou returnVector.resize(source.size(), 0); //the "nextPerm" is the permutation to stop at. - //std::rotate(nextPerm.begin(), nextPerm.begin()+(rank+1)*offset, nextPerm.end()); + std::rotate(nextPerm.begin(), nextPerm.begin()+(rank+1), nextPerm.end()); //rotate my perm. - std::rotate(myPerm.begin(), myPerm.begin()+rank,myPerm.end()+rank+1); + std::rotate(myPerm.begin(), myPerm.begin()+rank,myPerm.end()); //std::cout << "source.last(): " << source[8].GetName() << std::endl; std::cout << "source: "; for(int i = 0; i < source.size(); i++){ @@ -37,18 +37,11 @@ std::vector MakePermutationMatrix::MakePermutation(std::vector sou std::cout << std::endl; do { double cost = 0; - std::cout <<"Rank: " << rank << " myPerm: "; - for(int i = 0; i < myPerm.size(); i++){ - std::cout << myPerm[i].GetName() << " "; - } - std::cout << std::endl; - //Add up the cost of the current permutation. for (int i = 1; i < myPerm.size(); i++) { cost += costMatrix[myPerm[i].GetName()][myPerm[i-1].GetName()]; } - // std::cout << "cost: " << cost <