Changeset f2ff738751 in tspsg for docs/html/tspsolver_8h_source.html
- Timestamp:
- Apr 28, 2010, 1:56:40 AM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 0773f1b65f
- Parents:
- 5d401f2c50
- git-author:
- Oleksii Serdiuk <contacts@…> (04/28/10 01:56:40)
- git-committer:
- Oleksii Serdiuk <contacts@…> (06/29/12 19:41:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/html/tspsolver_8h_source.html
r5d401f2c50 rf2ff738751 61 61 <li><a href="index.html"><span>Main Page</span></a></li> 62 62 <li><a href="pages.html"><span>Related Pages</span></a></li> 63 <li><a href="namespaces.html"><span>Namespaces</span></a></li> 63 64 <li><a href="annotated.html"><span>Classes</span></a></li> 64 65 <li class="current"><a href="files.html"><span>Files</span></a></li> … … 88 89 <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define TSPSOLVER_H</span> 89 90 <a name="l00030"></a>00030 <span class="preprocessor"></span> 90 <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="globals_8h.html" title="Contains TSPSG global defines.">globals.h</a>"</span> 91 <a name="l00032"></a>00032 92 <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="tspmodel_8h.html" title="Defines CTSPModel class.">tspmodel.h</a>"</span> 93 <a name="l00034"></a>00034 94 <a name="l00036"></a><a class="code" href="tspsolver_8h.html#a3addcca59ef59d0b3892b3670f808965">00036</a> <span class="keyword">typedef</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<QList<double></a> > <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a>; 95 <a name="l00037"></a>00037 96 <a name="l00041"></a><a class="code" href="struct_s_candidate.html">00041</a> <span class="keyword">struct </span><a class="code" href="struct_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> { 97 <a name="l00042"></a><a class="code" href="struct_s_candidate.html#aebab56506cadaa3c7d0e57037925cea5">00042</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_candidate.html#aebab56506cadaa3c7d0e57037925cea5" title="A zero-based row number of the candidate.">nRow</a>; 98 <a name="l00043"></a><a class="code" href="struct_s_candidate.html#a95a822e8bd7f4709ff24a7ba79f9f338">00043</a> <span class="keywordtype">int</span> <a class="code" href="struct_s_candidate.html#a95a822e8bd7f4709ff24a7ba79f9f338" title="A zero-based column number of the candidate.">nCol</a>; 99 <a name="l00044"></a>00044 100 <a name="l00046"></a><a class="code" href="struct_s_candidate.html#ad7ac35a48148fcc51614079714c03e6f">00046</a> <a class="code" href="struct_s_candidate.html#ad7ac35a48148fcc51614079714c03e6f" title="Assigns default values.">SCandidate</a>() { 101 <a name="l00047"></a>00047 <a class="code" href="struct_s_candidate.html#a95a822e8bd7f4709ff24a7ba79f9f338" title="A zero-based column number of the candidate.">nCol</a> = <a class="code" href="struct_s_candidate.html#aebab56506cadaa3c7d0e57037925cea5" title="A zero-based row number of the candidate.">nRow</a> = -1; 102 <a name="l00048"></a>00048 } 103 <a name="l00050"></a><a class="code" href="struct_s_candidate.html#a9e4f4f1861131ed23b5576f9cd8d4c68">00050</a> <span class="keywordtype">bool</span> <a class="code" href="struct_s_candidate.html#a9e4f4f1861131ed23b5576f9cd8d4c68" title="An operator == implementation.">operator ==</a>(<span class="keyword">const</span> <a class="code" href="struct_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> &cand)<span class="keyword"> const </span>{ 104 <a name="l00051"></a>00051 <span class="keywordflow">return</span> ((cand.<a class="code" href="struct_s_candidate.html#aebab56506cadaa3c7d0e57037925cea5" title="A zero-based row number of the candidate.">nRow</a> == <a class="code" href="struct_s_candidate.html#aebab56506cadaa3c7d0e57037925cea5" title="A zero-based row number of the candidate.">nRow</a>) && (cand.<a class="code" href="struct_s_candidate.html#a95a822e8bd7f4709ff24a7ba79f9f338" title="A zero-based column number of the candidate.">nCol</a> == <a class="code" href="struct_s_candidate.html#a95a822e8bd7f4709ff24a7ba79f9f338" title="A zero-based column number of the candidate.">nCol</a>)); 105 <a name="l00052"></a>00052 } 106 <a name="l00053"></a>00053 }; 107 <a name="l00054"></a>00054 108 <a name="l00060"></a><a class="code" href="struct_s_step.html">00060</a> <span class="keyword">struct </span><a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> { 109 <a name="l00061"></a><a class="code" href="struct_s_step.html#a0353eb66f83d46f88fb47cc2d1a923dd">00061</a> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> <a class="code" href="struct_s_step.html#a0353eb66f83d46f88fb47cc2d1a923dd" title="This step&#39;s matrix.">matrix</a>; 110 <a name="l00062"></a><a class="code" href="struct_s_step.html#a0355ec75846222996de07108a7c2e9c8">00062</a> <span class="keywordtype">double</span> <a class="code" href="struct_s_step.html#a0355ec75846222996de07108a7c2e9c8" title="The price of travel to this step.">price</a>; 111 <a name="l00063"></a><a class="code" href="struct_s_step.html#aeb798262cbff5ddd819a7056f8d21f21">00063</a> <a class="code" href="struct_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> <a class="code" href="struct_s_step.html#aeb798262cbff5ddd819a7056f8d21f21" title="A candiadate for branching in the current matrix.">candidate</a>; 112 <a name="l00064"></a><a class="code" href="struct_s_step.html#a02196d3433e2deed89ab540b875cd527">00064</a> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<SCandidate></a> <a class="code" href="struct_s_step.html#a02196d3433e2deed89ab540b875cd527" title="A list of alternative branching candidates.">alts</a>; 113 <a name="l00065"></a><a class="code" href="struct_s_step.html#a0fcce90c9c1c60f00b5a703b117b5e85">00065</a> <a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_s_step.html#a0fcce90c9c1c60f00b5a703b117b5e85" title="Pointer to the parent step.">pNode</a>; 114 <a name="l00066"></a><a class="code" href="struct_s_step.html#a8776e917cd02f86a57e103c025f5530c">00066</a> <a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_s_step.html#a8776e917cd02f86a57e103c025f5530c" title="Pointer to the left branch step.">plNode</a>; 115 <a name="l00067"></a><a class="code" href="struct_s_step.html#a51b304fcfc71508203d2becefcae5d31">00067</a> <a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_s_step.html#a51b304fcfc71508203d2becefcae5d31" title="Pointer to the right branch step.">prNode</a>; 116 <a name="l00068"></a>00068 117 <a name="l00070"></a><a class="code" href="struct_s_step.html#a450adac026150c0a49967a20ce46e51e">00070</a> <a class="code" href="struct_s_step.html#a450adac026150c0a49967a20ce46e51e" title="Assigns default values.">SStep</a>() { 118 <a name="l00071"></a>00071 <a class="code" href="struct_s_step.html#a0355ec75846222996de07108a7c2e9c8" title="The price of travel to this step.">price</a> = -1; 119 <a name="l00072"></a>00072 <a class="code" href="struct_s_step.html#a0fcce90c9c1c60f00b5a703b117b5e85" title="Pointer to the parent step.">pNode</a> = <a class="code" href="struct_s_step.html#a8776e917cd02f86a57e103c025f5530c" title="Pointer to the left branch step.">plNode</a> = <a class="code" href="struct_s_step.html#a51b304fcfc71508203d2becefcae5d31" title="Pointer to the right branch step.">prNode</a> = NULL; 120 <a name="l00073"></a>00073 } 121 <a name="l00074"></a>00074 }; 122 <a name="l00075"></a>00075 123 <a name="l00080"></a><a class="code" href="class_c_t_s_p_solver.html">00080</a> <span class="keyword">class </span><a class="code" href="class_c_t_s_p_solver.html" title="This class solves Travelling Salesman Problem task.">CTSPSolver</a>: <span class="keyword">public</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html">QObject</a> 124 <a name="l00081"></a>00081 { 125 <a name="l00082"></a>00082 Q_OBJECT 91 <a name="l00031"></a>00031 <span class="preprocessor">#include <QtCore></span> 92 <a name="l00032"></a>00032 <span class="preprocessor">#include <limits></span> 93 <a name="l00033"></a>00033 94 <a name="l00041"></a>00041 <span class="preprocessor">#ifdef INFINITY</span> 95 <a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor"> #undef INFINITY</span> 96 <a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 97 <a name="l00044"></a><a class="code" href="tspsolver_8h.html#a956e2723d559858d08644ac99146e910">00044</a> <span class="preprocessor"></span><span class="preprocessor">#define INFINITY std::numeric_limits<double>::infinity()</span> 98 <a name="l00045"></a>00045 <span class="preprocessor"></span> 99 <a name="l00051"></a>00051 <span class="keyword">namespace </span>TSPSolver { 100 <a name="l00052"></a>00052 101 <a name="l00054"></a><a class="code" href="namespace_t_s_p_solver.html#a54acd6743f0aa52d3022436d38a78f8c">00054</a> <span class="keyword">typedef</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<QList<double></a> > <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a>; 102 <a name="l00055"></a>00055 103 <a name="l00061"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html">00061</a> <span class="keyword">struct </span><a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> { 104 <a name="l00063"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html">00063</a> <span class="keyword">struct </span><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> { 105 <a name="l00064"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ae8336e07f26a5b51439c6c7ac3c15800">00064</a> <span class="keywordtype">int</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ae8336e07f26a5b51439c6c7ac3c15800" title="A zero-based row number of the candidate.">nRow</a>; 106 <a name="l00065"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#af6a9d9a2df92c1a56a7156ef7b9f6a27">00065</a> <span class="keywordtype">int</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#af6a9d9a2df92c1a56a7156ef7b9f6a27" title="A zero-based column number of the candidate.">nCol</a>; 107 <a name="l00066"></a>00066 108 <a name="l00068"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ad1f84242c537c8c824c5383cec63c233">00068</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ad1f84242c537c8c824c5383cec63c233" title="Assigns default values.">SCandidate</a>() { 109 <a name="l00069"></a>00069 <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#af6a9d9a2df92c1a56a7156ef7b9f6a27" title="A zero-based column number of the candidate.">nCol</a> = <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ae8336e07f26a5b51439c6c7ac3c15800" title="A zero-based row number of the candidate.">nRow</a> = -1; 110 <a name="l00070"></a>00070 } 111 <a name="l00072"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#a4ada1cd8006cf3b50d4a8e912965f0bc">00072</a> <span class="keywordtype">bool</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#a4ada1cd8006cf3b50d4a8e912965f0bc" title="An operator == implementation.">operator ==</a>(<span class="keyword">const</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> &cand)<span class="keyword"> const </span>{ 112 <a name="l00073"></a>00073 <span class="keywordflow">return</span> ((cand.<a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ae8336e07f26a5b51439c6c7ac3c15800" title="A zero-based row number of the candidate.">nRow</a> == <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#ae8336e07f26a5b51439c6c7ac3c15800" title="A zero-based row number of the candidate.">nRow</a>) && (cand.<a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#af6a9d9a2df92c1a56a7156ef7b9f6a27" title="A zero-based column number of the candidate.">nCol</a> == <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html#af6a9d9a2df92c1a56a7156ef7b9f6a27" title="A zero-based column number of the candidate.">nCol</a>)); 113 <a name="l00074"></a>00074 } 114 <a name="l00075"></a>00075 }; 115 <a name="l00076"></a>00076 116 <a name="l00078"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86">00078</a> <span class="keyword">enum</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86" title="An enum that describes possible selection of the next step.">NextStep</a> { 117 <a name="l00079"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86a3b8ba538613f8e35ff43828c6522c354">00079</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86a3b8ba538613f8e35ff43828c6522c354" title="No next step (end of solution).">NoNextStep</a>, 118 <a name="l00080"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86a077009b17a9710f3cf1a72803aa05243">00080</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86a077009b17a9710f3cf1a72803aa05243" title="Left branch was selected for the next step.">LeftBranch</a>, 119 <a name="l00081"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86aa09cf2c0a12d3097b67884e9c45e1818">00081</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86aa09cf2c0a12d3097b67884e9c45e1818" title="Right branch was selected for the next step.">RightBranch</a> 120 <a name="l00082"></a>00082 }; 126 121 <a name="l00083"></a>00083 127 <a name="l00084"></a> 00084 <span class="keyword">public</span>:128 <a name="l00085"></a> 00085 <span class="keyword">static</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> <a class="code" href="class_c_t_s_p_solver.html#a677a878c4c8a06316a5d8d5a4fc8ab65" title="Returns CTSPSolver&#39;s version ID.">getVersionId</a>();122 <a name="l00084"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#ae2ae1106147f4cd4a1e7a15c2bdf9cdc">00084</a> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#ae2ae1106147f4cd4a1e7a15c2bdf9cdc" title="This step&#39;s matrix.">matrix</a>; 123 <a name="l00085"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a881c1503127ad2426194700491ea4026">00085</a> <span class="keywordtype">double</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a881c1503127ad2426194700491ea4026" title="The price of travel to this step.">price</a>; 129 124 <a name="l00086"></a>00086 130 <a name="l00087"></a>00087 <a class="code" href="class_c_t_s_p_solver.html#a4a519caa89db1683693759a92a65319c" title="Constructs CTSPSolver object.">CTSPSolver</a>(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html">QObject</a> *<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html#parent">parent</a> = NULL); 131 <a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="class_c_t_s_p_solver.html#acf86422c1b8ff8e5b9bc88e09c57c48b" title="Cleans up the object and frees up memory used by the solution tree.">cleanup</a>(<span class="keywordtype">bool</span> processEvents = <span class="keyword">false</span>); 132 <a name="l00089"></a>00089 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> <a class="code" href="class_c_t_s_p_solver.html#a57556c971a25e3556c4aa3cc1fd2d3d0" title="Returns the sorted optimal path, starting from City 1.">getSortedPath</a>() <span class="keyword">const</span>; 133 <a name="l00090"></a>00090 <span class="keywordtype">bool</span> <a class="code" href="class_c_t_s_p_solver.html#a28d546e840cf53c639b45c0f26419f7a" title="Indicates whether or not the solution is definitely optimal.">isOptimal</a>() <span class="keyword">const</span>; 134 <a name="l00091"></a>00091 <a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="class_c_t_s_p_solver.html#a0f0f0aa60d05c97f3b0e867a381de558" title="Solves the given task.">solve</a>(<span class="keywordtype">int</span> numCities, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &task); 135 <a name="l00092"></a>00092 <span class="keywordtype">bool</span> <a class="code" href="class_c_t_s_p_solver.html#a80cff5d533711ab1929de1fdf09495b7" title="Indicates whether or not the solution process was canceled.">wasCanceled</a>() <span class="keyword">const</span>; 136 <a name="l00093"></a>00093 ~<a class="code" href="class_c_t_s_p_solver.html" title="This class solves Travelling Salesman Problem task.">CTSPSolver</a>(); 137 <a name="l00094"></a>00094 138 <a name="l00095"></a>00095 <span class="keyword">public</span> slots: 139 <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="class_c_t_s_p_solver.html#a996ac169e8ed087170bd8610fa4aa715" title="Cancels the solution process.">cancel</a>(); 140 <a name="l00097"></a>00097 141 <a name="l00098"></a>00098 signals: 142 <a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="class_c_t_s_p_solver.html#ae12895fa529a965b57204e355b9012d7" title="This signal is emitted once every time a part of the route is found.">routePartFound</a>(<span class="keywordtype">int</span> n); 143 <a name="l00104"></a>00104 144 <a name="l00105"></a>00105 <span class="keyword">private</span>: 145 <a name="l00106"></a>00106 <span class="keywordtype">bool</span> mayNotBeOptimal, canceled; 146 <a name="l00107"></a>00107 <span class="keywordtype">int</span> nCities; 147 <a name="l00108"></a>00108 <a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *root; 148 <a name="l00109"></a>00109 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html">QHash<int,int></a> route; 149 <a name="l00110"></a>00110 <span class="keyword">mutable</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qmutex.html">QMutex</a> mutex; 150 <a name="l00111"></a>00111 151 <a name="l00112"></a>00112 <span class="keywordtype">double</span> align(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix); 152 <a name="l00113"></a>00113 <span class="keywordtype">void</span> deleteTree(<a class="code" href="struct_s_step.html" title="This structure represents one step of solving.">SStep</a> *&root, <span class="keywordtype">bool</span> processEvents = <span class="keyword">false</span>); 153 <a name="l00114"></a>00114 <span class="keywordtype">void</span> denormalize(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix) <span class="keyword">const</span>; 154 <a name="l00115"></a>00115 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<SCandidate></a> findCandidate(<span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> &nRow, <span class="keywordtype">int</span> &nCol) <span class="keyword">const</span>; 155 <a name="l00116"></a>00116 <span class="keywordtype">double</span> findMinInCol(<span class="keywordtype">int</span> nCol, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> exr = -1) <span class="keyword">const</span>; 156 <a name="l00117"></a>00117 <span class="keywordtype">double</span> findMinInRow(<span class="keywordtype">int</span> nRow, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> exc = -1) <span class="keyword">const</span>; 157 <a name="l00118"></a>00118 <span class="keywordtype">bool</span> hasSubCycles(<span class="keywordtype">int</span> nRow, <span class="keywordtype">int</span> nCol) <span class="keyword">const</span>; 158 <a name="l00119"></a>00119 <span class="keywordtype">void</span> normalize(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix) <span class="keyword">const</span>; 159 <a name="l00120"></a>00120 <span class="keywordtype">void</span> subCol(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> nCol, <span class="keywordtype">double</span> val); 160 <a name="l00121"></a>00121 <span class="keywordtype">void</span> subRow(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> nRow, <span class="keywordtype">double</span> val); 161 <a name="l00122"></a>00122 }; 162 <a name="l00123"></a>00123 163 <a name="l00124"></a>00124 <span class="preprocessor">#ifdef DEBUG</span> 164 <a name="l00125"></a>00125 <span class="preprocessor"></span><a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> operator<<(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> dbg, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix); 165 <a name="l00126"></a>00126 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> operator<<(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> dbg, <span class="keyword">const</span> <a class="code" href="struct_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> &candidate); 166 <a name="l00127"></a>00127 <span class="preprocessor">#endif // DEBUG</span> 167 <a name="l00128"></a>00128 <span class="preprocessor"></span> 168 <a name="l00129"></a>00129 <span class="preprocessor">#endif // TSPSOLVER_H</span> 125 <a name="l00087"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af569aef4d00d3e33f39d8f251138860e">00087</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html" title="A structure that represents a candidate for branching.">SCandidate</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af569aef4d00d3e33f39d8f251138860e" title="A candiadate for branching in the current step.">candidate</a>; 126 <a name="l00088"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af95b7f421e7373e32548c64c358438d7">00088</a> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<SCandidate></a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af95b7f421e7373e32548c64c358438d7" title="A list of alternative branching candidates.">alts</a>; 127 <a name="l00089"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a4689e211e6a03f4b255243fde93ac54e">00089</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a4689e211e6a03f4b255243fde93ac54e" title="Pointer to the parent step.">pNode</a>; 128 <a name="l00090"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a3d4642f69b5eb7531697112341d31fd9">00090</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a3d4642f69b5eb7531697112341d31fd9" title="Pointer to the left branch step.">plNode</a>; 129 <a name="l00091"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a44db7deaa9dbb69eafdf5fc7efd2296b">00091</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a44db7deaa9dbb69eafdf5fc7efd2296b" title="Pointer to the right branch step.">prNode</a>; 130 <a name="l00092"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a8db8f6149eb89754aeefd35348292375">00092</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86" title="An enum that describes possible selection of the next step.">NextStep</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a8db8f6149eb89754aeefd35348292375" title="Indicates what branch was selected for the next step.">next</a>; 131 <a name="l00093"></a>00093 132 <a name="l00095"></a><a class="code" href="struct_t_s_p_solver_1_1_s_step.html#ae1d7209d6effb9fcfa28aafeac360c31">00095</a> <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#ae1d7209d6effb9fcfa28aafeac360c31" title="Assigns default values.">SStep</a>() { 133 <a name="l00096"></a>00096 <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a881c1503127ad2426194700491ea4026" title="The price of travel to this step.">price</a> = -1; 134 <a name="l00097"></a>00097 <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a4689e211e6a03f4b255243fde93ac54e" title="Pointer to the parent step.">pNode</a> = <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a3d4642f69b5eb7531697112341d31fd9" title="Pointer to the left branch step.">plNode</a> = <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a44db7deaa9dbb69eafdf5fc7efd2296b" title="Pointer to the right branch step.">prNode</a> = NULL; 135 <a name="l00098"></a>00098 <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#a8db8f6149eb89754aeefd35348292375" title="Indicates what branch was selected for the next step.">next</a> = <a class="code" href="struct_t_s_p_solver_1_1_s_step.html#af1a915528229317a309dfba9991fcd86a3b8ba538613f8e35ff43828c6522c354" title="No next step (end of solution).">NoNextStep</a>; 136 <a name="l00099"></a>00099 } 137 <a name="l00100"></a>00100 }; 138 <a name="l00101"></a>00101 139 <a name="l00106"></a><a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html">00106</a> <span class="keyword">class </span><a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html" title="This class solves Travelling Salesman Problem task.">CTSPSolver</a>: <span class="keyword">public</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html">QObject</a> 140 <a name="l00107"></a>00107 { 141 <a name="l00108"></a>00108 Q_OBJECT 142 <a name="l00109"></a>00109 143 <a name="l00110"></a>00110 <span class="keyword">public</span>: 144 <a name="l00111"></a>00111 <span class="keyword">static</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a71d04cbead3508cdff606a5ccc79e59e" title="Returns CTSPSolver&#39;s version ID.">getVersionId</a>(); 145 <a name="l00112"></a>00112 146 <a name="l00113"></a>00113 <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a71bebe073ed5149a4558a779410a2e6b" title="Constructs CTSPSolver object.">CTSPSolver</a>(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html">QObject</a> *<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qobject.html#parent">parent</a> = NULL); 147 <a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a3ef198959f1b4c32b84fbd5222f8b796" title="Cleans up the object and frees up memory used by the solution tree.">cleanup</a>(<span class="keywordtype">bool</span> processEvents = <span class="keyword">false</span>); 148 <a name="l00115"></a>00115 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a8897c0737ef2451ae606c38113477521" title="Returns the sorted optimal path, starting from City 1.">getSortedPath</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> &city, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> &separator = <span class="stringliteral">" -> "</span>) <span class="keyword">const</span>; 149 <a name="l00116"></a>00116 <span class="keywordtype">int</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a721973cc992b62750aae6fd3ab65773d" title="Returns a total number of steps in the current solution.">getTotalSteps</a>() <span class="keyword">const</span>; 150 <a name="l00117"></a>00117 <span class="keywordtype">bool</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a2b82ac68b981c47a3261f4e4e9ecd2bd" title="Indicates whether or not the solution is definitely optimal.">isOptimal</a>() <span class="keyword">const</span>; 151 <a name="l00118"></a>00118 <a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *<a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#ab8a5a387deebffd898577dba31a95099" title="Solves the given task.">solve</a>(<span class="keywordtype">int</span> numCities, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &task); 152 <a name="l00119"></a>00119 <span class="keywordtype">bool</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a6cce9079d60735f92037c98d6d361a82" title="Indicates whether or not the solution process was canceled.">wasCanceled</a>() <span class="keyword">const</span>; 153 <a name="l00120"></a>00120 ~<a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html" title="This class solves Travelling Salesman Problem task.">CTSPSolver</a>(); 154 <a name="l00121"></a>00121 155 <a name="l00122"></a>00122 <span class="keyword">public</span> slots: 156 <a name="l00123"></a>00123 <span class="keywordtype">void</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a46a3da58d4bb9431bea2c915ceaf1eea" title="Cancels the solution process.">cancel</a>(); 157 <a name="l00124"></a>00124 158 <a name="l00125"></a>00125 signals: 159 <a name="l00130"></a>00130 <span class="keywordtype">void</span> <a class="code" href="class_t_s_p_solver_1_1_c_t_s_p_solver.html#a5e02867f053089a3e096f6baa70499a2" title="This signal is emitted once every time a part of the route is found.">routePartFound</a>(<span class="keywordtype">int</span> n); 160 <a name="l00131"></a>00131 161 <a name="l00132"></a>00132 <span class="keyword">private</span>: 162 <a name="l00133"></a>00133 <span class="keywordtype">bool</span> mayNotBeOptimal, canceled; 163 <a name="l00134"></a>00134 <span class="keywordtype">int</span> nCities, total; 164 <a name="l00135"></a>00135 <a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *root; 165 <a name="l00136"></a>00136 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html">QHash<int,int></a> route; 166 <a name="l00137"></a>00137 <span class="keyword">mutable</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qmutex.html">QMutex</a> mutex; 167 <a name="l00138"></a>00138 168 <a name="l00139"></a>00139 <span class="keywordtype">double</span> align(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix); 169 <a name="l00140"></a>00140 <span class="keywordtype">void</span> deleteTree(<a class="code" href="struct_t_s_p_solver_1_1_s_step.html" title="This structure represents one step of solving.">SStep</a> *&root, <span class="keywordtype">bool</span> processEvents = <span class="keyword">false</span>); 170 <a name="l00141"></a>00141 <span class="keywordtype">void</span> denormalize(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix) <span class="keyword">const</span>; 171 <a name="l00142"></a>00142 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">QList<SStep::SCandidate></a> findCandidate(<span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> &nRow, <span class="keywordtype">int</span> &nCol) <span class="keyword">const</span>; 172 <a name="l00143"></a>00143 <span class="keywordtype">double</span> findMinInCol(<span class="keywordtype">int</span> nCol, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> exr = -1) <span class="keyword">const</span>; 173 <a name="l00144"></a>00144 <span class="keywordtype">double</span> findMinInRow(<span class="keywordtype">int</span> nRow, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> exc = -1) <span class="keyword">const</span>; 174 <a name="l00145"></a>00145 <span class="keywordtype">void</span> finishRoute(); 175 <a name="l00146"></a>00146 <span class="keywordtype">bool</span> hasSubCycles(<span class="keywordtype">int</span> nRow, <span class="keywordtype">int</span> nCol) <span class="keyword">const</span>; 176 <a name="l00147"></a>00147 <span class="keywordtype">void</span> normalize(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix) <span class="keyword">const</span>; 177 <a name="l00148"></a>00148 <span class="keywordtype">void</span> subCol(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> nCol, <span class="keywordtype">double</span> val); 178 <a name="l00149"></a>00149 <span class="keywordtype">void</span> subRow(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> &matrix, <span class="keywordtype">int</span> nRow, <span class="keywordtype">double</span> val); 179 <a name="l00150"></a>00150 }; 180 <a name="l00151"></a>00151 181 <a name="l00152"></a>00152 } 182 <a name="l00153"></a>00153 183 <a name="l00154"></a>00154 <span class="preprocessor">#ifdef DEBUG</span> 184 <a name="l00155"></a>00155 <span class="preprocessor"></span><a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> operator<<(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> dbg, <span class="keyword">const</span> <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TSPSolver::TMatrix</a> &matrix); 185 <a name="l00156"></a>00156 <a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> operator<<(<a class="codeRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qdebug.html">QDebug</a> dbg, <span class="keyword">const</span> <a class="code" href="struct_t_s_p_solver_1_1_s_step_1_1_s_candidate.html" title="A structure that represents a candidate for branching.">TSPSolver::SStep::SCandidate</a> &candidate); 186 <a name="l00157"></a>00157 <span class="preprocessor">#endif // DEBUG</span> 187 <a name="l00158"></a>00158 <span class="preprocessor"></span> 188 <a name="l00159"></a>00159 <span class="preprocessor">#endif // TSPSOLVER_H</span> 169 189 </pre></div></div> 170 190 <!--- window showing the filter options --> … … 173 193 onmouseout="return searchBox.OnSearchSelectHide()" 174 194 onkeydown="return searchBox.OnSearchSelectKey(event)"> 175 <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span> Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Defines</a></div>195 <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Defines</a></div> 176 196 177 197 <!-- iframe showing the search results (closed by default) --> … … 182 202 </div> 183 203 184 <hr size="1"/><address style="text-align: right;"><small>Generated on Fri Apr 9 00:25:382010 for TSPSG: TSP Solver and Generator by 204 <hr size="1"/><address style="text-align: right;"><small>Generated on Wed Apr 28 02:47:10 2010 for TSPSG: TSP Solver and Generator by 185 205 <a href="http://www.doxygen.org/index.html"> 186 206 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
Note: See TracChangeset
for help on using the changeset viewer.