Changeset 1270:dceba191c00d in lemon for lemon/insertion_tsp.h
- Timestamp:
- 08/09/13 11:28:17 (11 years ago)
- Branch:
- default
- Children:
- 1271:fb1c7da561ce, 1381:e0ccc1f0268f
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/insertion_tsp.h
r1250 r1270 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 361 361 Node u = _notused[i]; 362 362 Cost min_cost = costDiff(_tour.back(), _tour.front(), u); 363 int min_pos = 0; 363 int min_pos = 0; 364 364 for (unsigned int j=1; j<_tour.size(); ++j) { 365 365 Cost curr_cost = costDiff(_tour[j-1], _tour[j], u); … … 391 391 _notused[min_node] = _notused.back(); 392 392 _notused.pop_back(); 393 393 394 394 // Insert the selected node into the tour 395 395 const int ipos = _ins_pos[sn]; … … 406 406 Cost nc1 = costDiff(_tour[ipos_prev], _tour[ipos], u); 407 407 Cost nc2 = costDiff(_tour[ipos], _tour[ipos_next], u); 408 408 409 409 if (nc1 <= curr_cost || nc2 <= curr_cost) { 410 410 // A new position is better than the old one … … 421 421 // The minimum should be found again 422 422 curr_cost = costDiff(_tour.back(), _tour.front(), u); 423 curr_pos = 0; 423 curr_pos = 0; 424 424 for (unsigned int j=1; j<_tour.size(); ++j) { 425 425 Cost tmp_cost = costDiff(_tour[j-1], _tour[j], u); … … 434 434 } 435 435 } 436 436 437 437 _ins_cost[u] = curr_cost; 438 438 _ins_pos[u] = curr_pos;
Note: See TracChangeset
for help on using the changeset viewer.