I am Daniel N. I am a C++ Homework Expert at cpphomeworkhelp.com. I hold a Masters in Programming from the University of Leeds, UK. I have been helping students with their homework for the past 10 years. I solve homework related to C++.
Visit cpphomeworkhelp.com or email info@cpphomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with C++ Homework.
1. For any help regarding C++ Homework Help
Visit :- https://www.cpphomeworkhelp.com/ ,
Email :- info@cpphomeworkhelp.com or
2. Travelling Salesman Assignment Solution with C++
Write a multi-threaded program for solving the traveling salesman problem using
the branch-and-bound technique. You may use C++ or Java to implement this
multi-threaded program.
Task assignments to the threads may be static or dynamic. Since the multi-thread
program executes in a shared memory platform, both task assignment strategies can
easily be adopted. Experiment with the different number of threads for both task
assignment strategies, observe the execution times, and report your observations.
Recall in employing the branch and bound technique for solving the traveling
salesman problem, certain rules of inference would be useful in helping reduce the
size of the state space tree:
1. Use a heuristic to compute a lower bound for each node.
2. When considering the inclusion of an edge in a branch step, if the inclusion
will lead to more than 2 incident edges to a city, the branch can be terminated there.
cpphomeworkhelp.com
3. 3. When considering the inclusion of an edge in a branch step, if the inclusion will
result in a premature cycle (i.e., a cycle of size < the number of cities in the map), the
branch can be terminated there.
4. When considering the exclusion of an edge in a branch step, if the exclusion will
lead to a city not having 2 edges incident to it in the end, the branch can be terminated
there.
5.As soon as the search identifies a tour, record it as the best-cost-so-far. Update this cost
when a new tour with a better cost is found. This cost can be used in pruning those tree
nodes with lower bound >= this cost.
cpphomeworkhelp.com
4. #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <fstream>
#include <pthread.h>
using namespace std;
#define maximum_of_city 100
int number_city;
int
inputgraph[maximum_of_city]
[maximum_of_city];
int first = 0;
int threads = 2;
int flag;
cpphomeworkhelp.com
Solution
5. struct tspSearchParams {
int curr;
bool
visited_city[maximum_of_city];
int City[maximum_of_city];
float Lower_Bound = 0;
float edge_cost = 0;
float minimumcost = 0;
int level = 0;
int from = 0;
int to = 0;
bool multithread = false;
};
tspSearchParams*
copyParams(tspSearchParams* origin) {
tspSearchParams* copy = new
tspSearchParams();
cpphomeworkhelp.com