Skip to content
Snippets Groups Projects
Commit 3d340e85 authored by Jakub Janák's avatar Jakub Janák
Browse files

tsinstance updatedto accept number of threads

parent e49bb02c
No related branches found
No related tags found
No related merge requests found
......@@ -41,13 +41,13 @@ std::unique_ptr<TSInstance> TSInstance::create_synthetic_instance(const int numO
return std::make_unique<TSInstance>(std::move(nodes), std::move(edges));
}
std::vector<std::vector<Node> > TSInstance::solve(const std::string &args) {
std::vector<std::vector<Node> > TSInstance::solve(const std::string &args, const int num_of_threads) {
const auto start = std::chrono::high_resolution_clock::now();
const std::vector visitedNodes = {this->startingNode};
this->set_min_cost(heuristic_combo());
if (args == "p") {
// safe threads for M2 max: <= 8
start_branch_parallel(visitedNodes, 0, this->startingNode, 10);
start_branch_parallel(visitedNodes, 0, this->startingNode, num_of_threads);
} else {
branch(visitedNodes, 0, this->startingNode);
}
......
......@@ -25,7 +25,7 @@ public:
static std::unique_ptr<TSInstance> create_synthetic_instance(int numOfNodes);
std::vector<std::vector<Node> > solve(const std::string& arg);
std::vector<std::vector<Node> > solve(const std::string& arg, int num_of_threads = 4);
void branch(std::vector<Node> visitedNodes, double cost, Node &currentNode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment