資源簡介
旅行商問題(tsp) 三種解決算法,使用c++編寫,可自行測試使用
旅行商問題(tsp) 三種解決算法,使用c++編寫,可自行測試使用
代碼片段和文件信息
//-------------------------------------?tsp.cpp文件--------------------------------------------------???
#include?“AdjtwGraph.h“???
#include????
#include????
#include????
#include????
#include????
using?namespace?std;??
ofstream?fout(“out.txt“);??
int?N;??
AdjTWGraph?g;??
struct?Node??????
?{???int?currentIndex;??
?????int?level;??
?????Node?*?previous;??
?????Node(int?L?=?0?int?V?=?0?Node?*p?=?NULL):level(L)currentIndex(V)?previous(p)?{}??
};??
class?Tspbase??
{??
??protected:??????
????vector?currentPath;??
????vector?bestPath;??
????int?cv;??
????int?bestV;??
????Node?*?root;??
??
????void?EnumImplicit(int?k);??
void?BackTrackImplicit(int?k);??
??
????bool?Valid(Node?*pint?v)??//???
?????????{??bool?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-12?10:46??tsp\
?????文件????????2673??2012-11-28?09:55??tsp\AdjtwGraph.h
?????目錄???????????0??2012-12-12?10:46??tsp\Debug\
?????文件??????585812??2012-12-12?10:46??tsp\Debug\tsp.exe
?????文件??????830248??2012-12-12?10:46??tsp\Debug\tsp.ilk
?????文件??????393751??2012-12-12?10:46??tsp\Debug\tsp.obj
?????文件?????3218128??2012-12-12?10:21??tsp\Debug\tsp.pch
?????文件?????1156096??2012-12-12?10:46??tsp\Debug\tsp.pdb
?????文件???????99328??2012-12-12?10:46??tsp\Debug\vc60.idb
?????文件??????151552??2012-12-12?10:46??tsp\Debug\vc60.pdb
?????文件?????????198??2012-11-28?10:47??tsp\data.txt
?????文件?????????289??2012-12-12?10:46??tsp\out.txt
?????文件????????5925??2012-12-12?10:46??tsp\tsp.cpp
?????文件????????4313??2012-11-28?10:05??tsp\tsp.dsp
?????文件?????????512??2012-11-28?09:40??tsp\tsp.dsw
?????文件???????50176??2012-12-12?10:46??tsp\tsp.ncb
?????文件???????53760??2012-12-12?10:46??tsp\tsp.opt
?????文件????????1260??2012-12-12?10:46??tsp\tsp.plg
- 上一篇:c語言實現linux命令大概三四十個
- 下一篇:基于C++的雨流計數法程序
評論
共有 條評論