t
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "MakePermutationMatrix.h"
|
#include "MakePermutationMatrix.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> source, int rank, int size, std::vector<std::vector<double>> costMatrix){
|
std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> source, int rank, int size, std::vector<std::vector<double>> costMatrix){
|
||||||
std::vector<double> returnVector;
|
std::vector<double> returnVector;
|
||||||
@@ -35,7 +36,9 @@ std::vector<double> MakePermutationMatrix::MakePermutation(std::vector<City> sou
|
|||||||
for(int i = 0; i < localCostVector.size(); i++) {
|
for(int i = 0; i < localCostVector.size(); i++) {
|
||||||
if(localCostVector[i] < lowest[0])
|
if(localCostVector[i] < lowest[0])
|
||||||
lowest[0] = localCostVector[i];
|
lowest[0] = localCostVector[i];
|
||||||
|
std::cout << lowest[0] << " ";
|
||||||
}
|
}
|
||||||
|
std::cout<< std::endl;
|
||||||
MPI_Gather(&localCostVector,1, MPI_DOUBLE, &returnVector,1, MPI_DOUBLE,0, MPI_COMM_WORLD);
|
MPI_Gather(&localCostVector,1, MPI_DOUBLE, &returnVector,1, MPI_DOUBLE,0, MPI_COMM_WORLD);
|
||||||
|
|
||||||
return returnVector;
|
return returnVector;
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ int main(int argc, char* argv[])
|
|||||||
costs = MakePermutationMatrix::GetLowestCost(cities, rank, size, costMatrix);
|
costs = MakePermutationMatrix::GetLowestCost(cities, rank, size, costMatrix);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!rank){
|
// if(!rank){
|
||||||
std::cout << costs.size() << std::endl;
|
// std::cout << costs.size() << std::endl;
|
||||||
std::cout << costs[0];
|
// std::cout << costs[0];
|
||||||
}
|
// }
|
||||||
|
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user