1 | <!-- This comment will put IE 6, 7 and 8 in quirks mode --> |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
---|
6 | <title>TSPSG: TSP Solver and Generator: CTSPSolver Class Reference</title> |
---|
7 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
---|
8 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
---|
9 | <script type="text/javaScript" src="search/search.js"></script> |
---|
10 | <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
---|
11 | </head> |
---|
12 | <body onload='searchBox.OnSelectItem(0);'> |
---|
13 | <!-- Generated by Doxygen 1.6.1 --> |
---|
14 | <script type="text/javascript"><!-- |
---|
15 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
---|
16 | --></script> |
---|
17 | <script type="text/javascript"> |
---|
18 | <!-- |
---|
19 | function changeDisplayState (e){ |
---|
20 | var num=this.id.replace(/[^[0-9]/g,''); |
---|
21 | var button=this.firstChild; |
---|
22 | var sectionDiv=document.getElementById('dynsection'+num); |
---|
23 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
---|
24 | sectionDiv.style.display='block'; |
---|
25 | button.src='open.gif'; |
---|
26 | }else{ |
---|
27 | sectionDiv.style.display='none'; |
---|
28 | button.src='closed.gif'; |
---|
29 | } |
---|
30 | } |
---|
31 | function initDynSections(){ |
---|
32 | var divs=document.getElementsByTagName('div'); |
---|
33 | var sectionCounter=1; |
---|
34 | for(var i=0;i<divs.length-1;i++){ |
---|
35 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
---|
36 | var header=divs[i]; |
---|
37 | var section=divs[i+1]; |
---|
38 | var button=header.firstChild; |
---|
39 | if (button!='IMG'){ |
---|
40 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
---|
41 | button=document.createElement('img'); |
---|
42 | divs[i].insertBefore(button,divs[i].firstChild); |
---|
43 | } |
---|
44 | header.style.cursor='pointer'; |
---|
45 | header.onclick=changeDisplayState; |
---|
46 | header.id='dynheader'+sectionCounter; |
---|
47 | button.src='closed.gif'; |
---|
48 | section.id='dynsection'+sectionCounter; |
---|
49 | section.style.display='none'; |
---|
50 | section.style.marginLeft='14px'; |
---|
51 | sectionCounter++; |
---|
52 | } |
---|
53 | } |
---|
54 | } |
---|
55 | window.onload = initDynSections; |
---|
56 | --> |
---|
57 | </script> |
---|
58 | <div class="navigation" id="top"> |
---|
59 | <div class="tabs"> |
---|
60 | <ul> |
---|
61 | <li><a href="index.html"><span>Main Page</span></a></li> |
---|
62 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
63 | <li class="current"><a href="annotated.html"><span>Classes</span></a></li> |
---|
64 | <li><a href="files.html"><span>Files</span></a></li> |
---|
65 | <li> |
---|
66 | <div id="MSearchBox" class="MSearchBoxInactive"> |
---|
67 | <img id="MSearchSelect" src="search/search.png" |
---|
68 | onmouseover="return searchBox.OnSearchSelectShow()" |
---|
69 | onmouseout="return searchBox.OnSearchSelectHide()" |
---|
70 | alt=""/> |
---|
71 | <input type="text" id="MSearchField" value="Search" accesskey="S" |
---|
72 | onfocus="searchBox.OnSearchFieldFocus(true)" |
---|
73 | onblur="searchBox.OnSearchFieldFocus(false)" |
---|
74 | onkeyup="searchBox.OnSearchFieldChange(event)"/> |
---|
75 | <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
---|
76 | </div> |
---|
77 | </li> |
---|
78 | </ul> |
---|
79 | </div> |
---|
80 | <div class="tabs"> |
---|
81 | <ul> |
---|
82 | <li><a href="annotated.html"><span>Class List</span></a></li> |
---|
83 | <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> |
---|
84 | <li><a href="functions.html"><span>Class Members</span></a></li> |
---|
85 | </ul> |
---|
86 | </div> |
---|
87 | </div> |
---|
88 | <div class="contents"> |
---|
89 | <h1>CTSPSolver Class Reference</h1><!-- doxytag: class="CTSPSolver" --> |
---|
90 | <p>This class solves Travelling Salesman Problem task. |
---|
91 | <a href="#_details">More...</a></p> |
---|
92 | |
---|
93 | <p><code>#include <<a class="el" href="tspsolver_8h_source.html">tspsolver.h</a>></code></p> |
---|
94 | <div class="dynheader"> |
---|
95 | Collaboration diagram for CTSPSolver:</div> |
---|
96 | <div class="dynsection"> |
---|
97 | <div class="center"><img src="class_c_t_s_p_solver__coll__graph.png" border="0" usemap="#_c_t_s_p_solver_coll__map" alt="Collaboration graph"/></div> |
---|
98 | <map name="_c_t_s_p_solver_coll__map" id="_c_t_s_p_solver_coll__map"> |
---|
99 | <area shape="rect" id="node2" href="struct_s_step.html" title="This structure represents one step of solving." alt="" coords="241,109,297,137"/> |
---|
100 | <area shape="rect" id="node4" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html" title="QList\< QList\< double \> \>" alt="" coords="5,6,173,34"/> |
---|
101 | <area shape="rect" id="node7" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html" title="QList\< SCandidate \>" alt="" coords="197,6,341,34"/> |
---|
102 | <area shape="rect" id="node9" href="struct_s_candidate.html" title="A structure that represents a candidate for branching." alt="" coords="365,6,453,34"/> |
---|
103 | <area shape="rect" id="node11" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html" title="QHash\< int, int \>" alt="" coords="387,109,507,137"/> |
---|
104 | </map> |
---|
105 | <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> |
---|
106 | |
---|
107 | <p><a href="class_c_t_s_p_solver-members.html">List of all members.</a></p> |
---|
108 | <table border="0" cellpadding="0" cellspacing="0"> |
---|
109 | <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> |
---|
110 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa5e45813d8f5e1c039b1bb9746d367bd"></a><!-- doxytag: member="CTSPSolver::CTSPSolver" ref="aa5e45813d8f5e1c039b1bb9746d367bd" args="()" --> |
---|
111 | </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#aa5e45813d8f5e1c039b1bb9746d367bd">CTSPSolver</a> ()</td></tr> |
---|
112 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Class constructor. <br/></td></tr> |
---|
113 | <tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a57556c971a25e3556c4aa3cc1fd2d3d0">getSortedPath</a> () const </td></tr> |
---|
114 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sorted optimal path, starting from City 1. <a href="#a57556c971a25e3556c4aa3cc1fd2d3d0"></a><br/></td></tr> |
---|
115 | <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a28d546e840cf53c639b45c0f26419f7a">isOptimal</a> () const </td></tr> |
---|
116 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether or not the solution is definitely optimal. <a href="#a28d546e840cf53c639b45c0f26419f7a"></a><br/></td></tr> |
---|
117 | <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_s_step.html">SStep</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a9a6545dd05e449151aabe325f4058edd">solve</a> (int numCities, <a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> task, <a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qwidget.html">QWidget</a> *parent=0)</td></tr> |
---|
118 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Solves the given task. <a href="#a9a6545dd05e449151aabe325f4058edd"></a><br/></td></tr> |
---|
119 | <tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr> |
---|
120 | <tr><td class="memItemLeft" align="right" valign="top">static <a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a677a878c4c8a06316a5d8d5a4fc8ab65">getVersionId</a> ()</td></tr> |
---|
121 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns CTSPSolver's version ID. <a href="#a677a878c4c8a06316a5d8d5a4fc8ab65"></a><br/></td></tr> |
---|
122 | </table> |
---|
123 | <hr/><a name="_details"></a><h2>Detailed Description</h2> |
---|
124 | <p>This class solves Travelling Salesman Problem task. </p> |
---|
125 | <dl class="author"><dt><b>Author:</b></dt><dd>Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> </dd></dl> |
---|
126 | <hr/><h2>Member Function Documentation</h2> |
---|
127 | <a class="anchor" id="a57556c971a25e3556c4aa3cc1fd2d3d0"></a><!-- doxytag: member="CTSPSolver::getSortedPath" ref="a57556c971a25e3556c4aa3cc1fd2d3d0" args="() const " --> |
---|
128 | <div class="memitem"> |
---|
129 | <div class="memproto"> |
---|
130 | <table class="memname"> |
---|
131 | <tr> |
---|
132 | <td class="memname"><a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> CTSPSolver::getSortedPath </td> |
---|
133 | <td>(</td> |
---|
134 | <td class="paramname"></td> |
---|
135 | <td> ) </td> |
---|
136 | <td> const</td> |
---|
137 | </tr> |
---|
138 | </table> |
---|
139 | </div> |
---|
140 | <div class="memdoc"> |
---|
141 | |
---|
142 | <p>Returns the sorted optimal path, starting from City 1. </p> |
---|
143 | <dl class="return"><dt><b>Returns:</b></dt><dd>A string, containing sorted optimal path. </dd></dl> |
---|
144 | |
---|
145 | <p><div class="dynheader"> |
---|
146 | Here is the call graph for this function:</div> |
---|
147 | <div class="dynsection"> |
---|
148 | <div class="center"><img src="class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph.png" border="0" usemap="#class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph_map" alt=""></div> |
---|
149 | <map name="class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph_map" id="class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph"> |
---|
150 | <area shape="rect" id="node3" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html#arg" title="QString::arg" alt="" coords="248,5,339,33"/> |
---|
151 | <area shape="rect" id="node5" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html#isEmpty" title="QHash::isEmpty" alt="" coords="235,55,352,83"/> |
---|
152 | <area shape="rect" id="node7" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html#size" title="QHash::size" alt="" coords="247,106,340,134"/> |
---|
153 | </map> |
---|
154 | </div> |
---|
155 | </p> |
---|
156 | |
---|
157 | </div> |
---|
158 | </div> |
---|
159 | <a class="anchor" id="a677a878c4c8a06316a5d8d5a4fc8ab65"></a><!-- doxytag: member="CTSPSolver::getVersionId" ref="a677a878c4c8a06316a5d8d5a4fc8ab65" args="()" --> |
---|
160 | <div class="memitem"> |
---|
161 | <div class="memproto"> |
---|
162 | <table class="memname"> |
---|
163 | <tr> |
---|
164 | <td class="memname"><a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qstring.html">QString</a> CTSPSolver::getVersionId </td> |
---|
165 | <td>(</td> |
---|
166 | <td class="paramname"></td> |
---|
167 | <td> ) </td> |
---|
168 | <td><code> [static]</code></td> |
---|
169 | </tr> |
---|
170 | </table> |
---|
171 | </div> |
---|
172 | <div class="memdoc"> |
---|
173 | |
---|
174 | <p>Returns CTSPSolver's version ID. </p> |
---|
175 | <dl class="return"><dt><b>Returns:</b></dt><dd>A string: <b>$Id: tspsolver.cpp 93 2010-02-23 22:17:48Z laleppa $</b>. </dd></dl> |
---|
176 | |
---|
177 | </div> |
---|
178 | </div> |
---|
179 | <a class="anchor" id="a28d546e840cf53c639b45c0f26419f7a"></a><!-- doxytag: member="CTSPSolver::isOptimal" ref="a28d546e840cf53c639b45c0f26419f7a" args="() const " --> |
---|
180 | <div class="memitem"> |
---|
181 | <div class="memproto"> |
---|
182 | <table class="memname"> |
---|
183 | <tr> |
---|
184 | <td class="memname">bool CTSPSolver::isOptimal </td> |
---|
185 | <td>(</td> |
---|
186 | <td class="paramname"></td> |
---|
187 | <td> ) </td> |
---|
188 | <td> const</td> |
---|
189 | </tr> |
---|
190 | </table> |
---|
191 | </div> |
---|
192 | <div class="memdoc"> |
---|
193 | |
---|
194 | <p>Returns whether or not the solution is definitely optimal. </p> |
---|
195 | <dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if solution is definitely optimal, otherwise <code>false</code>.</dd></dl> |
---|
196 | <p>The solution may need some further interations to determine whether it is optimal. In such cases this function returns <code>false</code>. </p> |
---|
197 | |
---|
198 | </div> |
---|
199 | </div> |
---|
200 | <a class="anchor" id="a9a6545dd05e449151aabe325f4058edd"></a><!-- doxytag: member="CTSPSolver::solve" ref="a9a6545dd05e449151aabe325f4058edd" args="(int numCities, TMatrix task, QWidget *parent=0)" --> |
---|
201 | <div class="memitem"> |
---|
202 | <div class="memproto"> |
---|
203 | <table class="memname"> |
---|
204 | <tr> |
---|
205 | <td class="memname"><a class="el" href="struct_s_step.html">SStep</a> * CTSPSolver::solve </td> |
---|
206 | <td>(</td> |
---|
207 | <td class="paramtype">int </td> |
---|
208 | <td class="paramname"> <em>numCities</em>, </td> |
---|
209 | </tr> |
---|
210 | <tr> |
---|
211 | <td class="paramkey"></td> |
---|
212 | <td></td> |
---|
213 | <td class="paramtype"><a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html">TMatrix</a> </td> |
---|
214 | <td class="paramname"> <em>task</em>, </td> |
---|
215 | </tr> |
---|
216 | <tr> |
---|
217 | <td class="paramkey"></td> |
---|
218 | <td></td> |
---|
219 | <td class="paramtype"><a class="elRef" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qwidget.html">QWidget</a> * </td> |
---|
220 | <td class="paramname"> <em>parent</em> = <code>0</code></td><td> </td> |
---|
221 | </tr> |
---|
222 | <tr> |
---|
223 | <td></td> |
---|
224 | <td>)</td> |
---|
225 | <td></td><td></td><td></td> |
---|
226 | </tr> |
---|
227 | </table> |
---|
228 | </div> |
---|
229 | <div class="memdoc"> |
---|
230 | |
---|
231 | <p>Solves the given task. </p> |
---|
232 | <dl><dt><b>Parameters:</b></dt><dd> |
---|
233 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
234 | <tr><td valign="top"></td><td valign="top"><em>numCities</em> </td><td>Number of cities in the task. </td></tr> |
---|
235 | <tr><td valign="top"></td><td valign="top"><em>task</em> </td><td>The matrix of city-to-city travel costs. </td></tr> |
---|
236 | <tr><td valign="top"></td><td valign="top"><em>parent</em> </td><td>The parent widget for displaying messages and dialogs. </td></tr> |
---|
237 | </table> |
---|
238 | </dd> |
---|
239 | </dl> |
---|
240 | <dl class="return"><dt><b>Returns:</b></dt><dd>Pointer to the root of the solution tree.</dd></dl> |
---|
241 | <dl class="todo"><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>TODO: Comment the algorithm. </dd></dl> |
---|
242 | |
---|
243 | <p><div class="dynheader"> |
---|
244 | Here is the call graph for this function:</div> |
---|
245 | <div class="dynsection"> |
---|
246 | <div class="center"><img src="class_c_t_s_p_solver_a9a6545dd05e449151aabe325f4058edd_cgraph.png" border="0" usemap="#class_c_t_s_p_solver_a9a6545dd05e449151aabe325f4058edd_cgraph_map" alt=""></div> |
---|
247 | <map name="class_c_t_s_p_solver_a9a6545dd05e449151aabe325f4058edd_cgraph_map" id="class_c_t_s_p_solver_a9a6545dd05e449151aabe325f4058edd_cgraph"> |
---|
248 | <area shape="rect" id="node3" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qprogressdialog.html#reset" title="QProgressDialog::reset" alt="" coords="187,5,341,33"/> |
---|
249 | <area shape="rect" id="node5" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qprogressdialog.html#setBar" title="QProgressDialog::setBar" alt="" coords="181,55,347,83"/> |
---|
250 | <area shape="rect" id="node7" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qhash.html#size" title="QHash::size" alt="" coords="217,106,311,134"/> |
---|
251 | </map> |
---|
252 | </div> |
---|
253 | </p> |
---|
254 | |
---|
255 | </div> |
---|
256 | </div> |
---|
257 | <hr/>The documentation for this class was generated from the following files:<ul> |
---|
258 | <li>src/<a class="el" href="tspsolver_8h_source.html">tspsolver.h</a></li> |
---|
259 | <li>src/tspsolver.cpp</li> |
---|
260 | </ul> |
---|
261 | </div> |
---|
262 | <!--- window showing the filter options --> |
---|
263 | <div id="MSearchSelectWindow" |
---|
264 | onmouseover="return searchBox.OnSearchSelectShow()" |
---|
265 | onmouseout="return searchBox.OnSearchSelectHide()" |
---|
266 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
---|
267 | <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> |
---|
268 | |
---|
269 | <!-- iframe showing the search results (closed by default) --> |
---|
270 | <div id="MSearchResultsWindow"> |
---|
271 | <iframe src="" frameborder="0" |
---|
272 | name="MSearchResults" id="MSearchResults"> |
---|
273 | </iframe> |
---|
274 | </div> |
---|
275 | |
---|
276 | <hr size="1"/><address style="text-align: right;"><small>Generated on Wed Mar 3 01:46:35 2010 for TSPSG: TSP Solver and Generator by |
---|
277 | <a href="http://www.doxygen.org/index.html"> |
---|
278 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> |
---|
279 | </body> |
---|
280 | </html> |
---|