Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .vs/Serial/v15/.suo
Binary file not shown.
Binary file modified .vs/Serial/v15/Browse.VC.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Debug/Serial.exe
Binary file not shown.
Binary file modified Debug/Serial.ilk
Binary file not shown.
Binary file modified Debug/Serial.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Serial/Debug/Serial.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
 iterative2.cpp
Serial.vcxproj -> C:\Users\Solomon\Documents\Unity Projects\TopDownStealth\ParallelProgrammingProject\Debug\Serial.exe
Serial.vcxproj -> E:\Other Projects\ParallelProgrammingProject\ParallelProgrammingProject\Debug\Serial.exe
Binary file modified Serial/Debug/Serial.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified Serial/Debug/Serial.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Serial/Debug/Serial.tlog/CL.write.1.tlog
Binary file not shown.
2 changes: 1 addition & 1 deletion Serial/Debug/Serial.tlog/Serial.lastbuildstate
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.16299.0
Debug|Win32|C:\Users\Solomon\Documents\Unity Projects\TopDownStealth\ParallelProgrammingProject\|
Debug|Win32|E:\Other Projects\ParallelProgrammingProject\ParallelProgrammingProject\|
Binary file modified Serial/Debug/Serial.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified Serial/Debug/Serial.tlog/link.write.1.tlog
Binary file not shown.
Binary file modified Serial/Debug/iterative1.obj
Binary file not shown.
Binary file modified Serial/Debug/iterative2.obj
Binary file not shown.
Binary file modified Serial/Debug/main.obj
Binary file not shown.
Binary file modified Serial/Debug/recursive.obj
Binary file not shown.
Binary file modified Serial/Debug/vc141.idb
Binary file not shown.
Binary file modified Serial/Debug/vc141.pdb
Binary file not shown.
2 changes: 0 additions & 2 deletions Serial/Serial.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,11 @@
<ClCompile Include="iterative2.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="recursive.cpp" />
<ClCompile Include="Tour.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="iterative1.h" />
<ClInclude Include="iterative2.h" />
<ClInclude Include="recursive.h" />
<ClInclude Include="Tour.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
6 changes: 0 additions & 6 deletions Serial/Serial.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
<ClCompile Include="iterative2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Tour.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="iterative1.h">
Expand All @@ -41,8 +38,5 @@
<ClInclude Include="iterative2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Tour.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
5 changes: 0 additions & 5 deletions Serial/Tour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ size_t Tour::GetCityCount() const
return size_t();
}

size_t Tour::GetCityCount() const
{
return size_t();
}

size_t Tour::GetTotalTourCost() const
{
return size_t();
Expand Down
24 changes: 19 additions & 5 deletions Serial/iterative2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ iterative2::~iterative2()
//Copies the passed tour and pushes it into the stack
int * iterative2::PushCopy(int * tour)
{
std::array<int, 4> newTour = tour;
int* newTour = new int[sizeof(tour)];
for (int i = 0; i < sizeof(tour); i++)
{
newTour[i] = tour[i];
}
theStack.push(newTour);
return newTour;
}
Expand Down Expand Up @@ -61,14 +65,23 @@ int iterative2::CityCount(int * currentTour)
//Checks if the passed tour is a better tour than the current bestTour
bool iterative2::BestTour(int * currentTour)
{
//for (int i = 0; i < sizeof(currentTour); i++)
//{
// cout << currentTour[i] << endl;
//}

int newTour = 0;
//current tour score
int cTourScore = 0;
//cout << "Got before for loop" << endl;
for (int i = 0; i < NUM_CITIES - 1; i++)
{
newTour += adjMat[currentTour[i]][currentTour[i + 1]];
currentTour += adjMat[bestTour[i]][bestTour[i + 1]];
//cout << "newTour = " << newTour << endl;
cTourScore += adjMat[bestTour[i]][bestTour[i + 1]];
//cout << "currentTour = " << currentTour << endl;
}
//cout << "Got through for loop" << endl;
newTour += adjMat[currentTour[NUM_CITIES - 1]][currentTour[HOMETOWN]];
cTourScore += adjMat[bestTour[NUM_CITIES - 1]][currentTour[HOMETOWN]];
return newTour < cTourScore;
Expand Down Expand Up @@ -105,24 +118,25 @@ void iterative2::RemoveLastCity(int * currentTour)
//Does a breadth first search to find the best tour using a stack of partial tours
void iterative2::DepthFirstSearch(int * currentTour)
{
cout << "DepthFirstSearchStarting" << endl;
//cout << "DepthFirstSearchStarting" << endl;
PushCopy(currentTour);
while (!Empty())
{
int* currTour = Pop();
if (CityCount(currTour) == NUM_CITIES)
{
cout << "if" << endl;
//cout << "if" << endl;
if (BestTour(currTour))
{
//cout << "if" << endl;
UpdateBestTour(currTour);
}
}
else
{
for (int nbr = NUM_CITIES - 1; nbr >= 1; nbr--)
{
cout << "Else" << endl;
//cout << "Else" << endl;
if (Feasible(currTour, nbr))
{
AddCity(currTour, nbr);
Expand Down