Auto Commit
This commit is contained in:
@@ -14,6 +14,7 @@ std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> sou
|
|||||||
std::sort(source.begin(), source.end());
|
std::sort(source.begin(), source.end());
|
||||||
std::vector<City> myPerm = source;
|
std::vector<City> myPerm = source;
|
||||||
std::vector<City> nextPerm = source;
|
std::vector<City> 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.
|
//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);
|
returnVector.resize(source.size(), 0);
|
||||||
@@ -52,9 +53,10 @@ std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> sou
|
|||||||
cost += costMatrix[myPerm[i].GetName()][myPerm[i-1].GetName()];
|
cost += costMatrix[myPerm[i].GetName()][myPerm[i-1].GetName()];
|
||||||
}
|
}
|
||||||
std::cout << std::endl << std::endl;
|
std::cout << std::endl << std::endl;
|
||||||
|
if(cost < lowest)
|
||||||
|
lowest = cost;
|
||||||
//Push permutation cost to the localCostVector.
|
//Push permutation cost to the localCostVector.
|
||||||
localCostVector.push_back(cost);
|
//localCostVector.push_back(cost);
|
||||||
} while (std::next_permutation(myPerm.begin(), myPerm.end()) && myPerm!=nextPerm);
|
} while (std::next_permutation(myPerm.begin(), myPerm.end()) && myPerm!=nextPerm);
|
||||||
|
|
||||||
// //find the lowest and add it to a lowest vector.
|
// //find the lowest and add it to a lowest vector.
|
||||||
@@ -65,7 +67,7 @@ std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> sou
|
|||||||
// std::cout << lowest[0] << " ";
|
// 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: ";
|
std::cout << "Rank: "<< rank <<" Last Perm: ";
|
||||||
for(int i = 0; i < myPerm.size(); i++){
|
for(int i = 0; i < myPerm.size(); i++){
|
||||||
std::cout << myPerm[i].GetName() << " ";
|
std::cout << myPerm[i].GetName() << " ";
|
||||||
|
|||||||
@@ -6,10 +6,3 @@
|
|||||||
10 11
|
10 11
|
||||||
12 13
|
12 13
|
||||||
14 15
|
14 15
|
||||||
1 2
|
|
||||||
3 4
|
|
||||||
8 9
|
|
||||||
10 11
|
|
||||||
12 13
|
|
||||||
14 15
|
|
||||||
1 2
|
|
||||||
Reference in New Issue
Block a user