Skip to content
Open
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
6 changes: 6 additions & 0 deletions lesson5/solver_by_greedy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class TSP {
double tmp = inf;
int next = 0;
for (auto next_candidate : not_visited) {
// ALEXNOTE: nice use of C++ latest features !

// ALEXNOTE: line below does two unnecessary dictionary lookaps
// (expression dist_[now][next_candidate] is invoked twice)
if (tmp > dist_[now][next_candidate]) {
tmp = dist_[now][next_candidate];
next = next_candidate;
Expand Down Expand Up @@ -97,6 +101,8 @@ std::vector<std::vector<double>> LoadCoordinates(std::string input_file_path) {
return coordinates;
}

// ALEXNOTE: you may want to create a common library for this code
// which is common for all versions.
// Create output file name from input file path and prefix
// if no output file path is provided.
// ex) input_0.csv -> ${prefix}_0.csv
Expand Down