source: tspsg-svn/trunk/docs/html/class_c_t_s_p_solver.html @ 73

Last change on this file since 73 was 72, checked in by laleppa, 15 years ago

Documentation update:
+ Added call and caller graphs.
+ Documentation now references Qt 4.6 documentation for Qt classes.

File size: 16.3 KB
Line 
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"><!--
15var searchBox = new SearchBox("searchBox", "search",false,'Search');
16--></script>
17<script type="text/javascript">
18<!--
19function 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}
31function 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}
55window.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&nbsp;Page</span></a></li>
62      <li><a href="pages.html"><span>Related&nbsp;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&nbsp;List</span></a></li>
83      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
84      <li><a href="functions.html"><span>Class&nbsp;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 &lt;<a class="el" href="tspsolver_8h_source.html">tspsolver.h</a>&gt;</code></p>
94<div class="dynheader">
95Collaboration 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="structs_step.html" title="This structure represents one step of solving." alt="" coords="61,101,117,129"/>
100<area shape="rect" id="node5" doxygen="qt-4.6.tag:http://doc.trolltech.com/4.6/" href="http://doc.trolltech.com/4.6/qlist.html" title="QList\&lt; QList\&lt; double \&gt; \&gt;" 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/qhash.html" title="QHash\&lt; int, int \&gt;" alt="" coords="207,101,327,129"/>
102</map>
103<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
104
105<p><a href="class_c_t_s_p_solver-members.html">List of all members.</a></p>
106<table border="0" cellpadding="0" cellspacing="0">
107<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
108<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa5e45813d8f5e1c039b1bb9746d367bd"></a><!-- doxytag: member="CTSPSolver::CTSPSolver" ref="aa5e45813d8f5e1c039b1bb9746d367bd" args="()" -->
109&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#aa5e45813d8f5e1c039b1bb9746d367bd">CTSPSolver</a> ()</td></tr>
110<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Class constructor. <br/></td></tr>
111<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>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a57556c971a25e3556c4aa3cc1fd2d3d0">getSortedPath</a> () const </td></tr>
112<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the sorted optimal path, starting from City 1.  <a href="#a57556c971a25e3556c4aa3cc1fd2d3d0"></a><br/></td></tr>
113<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a28d546e840cf53c639b45c0f26419f7a">isOptimal</a> () const </td></tr>
114<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether or not the solution is definitely optimal.  <a href="#a28d546e840cf53c639b45c0f26419f7a"></a><br/></td></tr>
115<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structs_step.html">sStep</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#abc4a62fa7954327949926473309d6bc3">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>
116<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Solves the given task.  <a href="#abc4a62fa7954327949926473309d6bc3"></a><br/></td></tr>
117<tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr>
118<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>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_t_s_p_solver.html#a677a878c4c8a06316a5d8d5a4fc8ab65">getVersionId</a> ()</td></tr>
119<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns CTSPSolver's version ID.  <a href="#a677a878c4c8a06316a5d8d5a4fc8ab65"></a><br/></td></tr>
120</table>
121<hr/><a name="_details"></a><h2>Detailed Description</h2>
122<p>This class solves Travelling Salesman Problem task. </p>
123<dl class="author"><dt><b>Author:</b></dt><dd>Copyright &copy; 2007-2009 Lёppa &lt;contacts[at]oleksii[dot]name&gt;</dd></dl>
124<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000004">Todo:</a></b></dt><dd>TODO: Deletion of solution tree on destroy and cleanup. </dd></dl>
125<hr/><h2>Member Function Documentation</h2>
126<a class="anchor" id="a57556c971a25e3556c4aa3cc1fd2d3d0"></a><!-- doxytag: member="CTSPSolver::getSortedPath" ref="a57556c971a25e3556c4aa3cc1fd2d3d0" args="() const " -->
127<div class="memitem">
128<div class="memproto">
129      <table class="memname">
130        <tr>
131          <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>
132          <td>(</td>
133          <td class="paramname"></td>
134          <td>&nbsp;)&nbsp;</td>
135          <td> const</td>
136        </tr>
137      </table>
138</div>
139<div class="memdoc">
140
141<p>Returns the sorted optimal path, starting from City 1. </p>
142<dl class="return"><dt><b>Returns:</b></dt><dd>A string, containing sorted optimal path. </dd></dl>
143
144<p><div class="dynheader">
145Here is the call graph for this function:</div>
146<div class="dynsection">
147<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>
148<map name="class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph_map" id="class_c_t_s_p_solver_a57556c971a25e3556c4aa3cc1fd2d3d0_cgraph">
149<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"/>
150<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"/>
151<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"/>
152</map>
153</div>
154</p>
155
156</div>
157</div>
158<a class="anchor" id="a677a878c4c8a06316a5d8d5a4fc8ab65"></a><!-- doxytag: member="CTSPSolver::getVersionId" ref="a677a878c4c8a06316a5d8d5a4fc8ab65" args="()" -->
159<div class="memitem">
160<div class="memproto">
161      <table class="memname">
162        <tr>
163          <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>
164          <td>(</td>
165          <td class="paramname"></td>
166          <td>&nbsp;)&nbsp;</td>
167          <td><code> [static]</code></td>
168        </tr>
169      </table>
170</div>
171<div class="memdoc">
172
173<p>Returns CTSPSolver's version ID. </p>
174<dl class="return"><dt><b>Returns:</b></dt><dd>A string: <b>$Id: tspsolver.cpp 71 2009-12-07 16:06:44Z laleppa $</b>. </dd></dl>
175
176</div>
177</div>
178<a class="anchor" id="a28d546e840cf53c639b45c0f26419f7a"></a><!-- doxytag: member="CTSPSolver::isOptimal" ref="a28d546e840cf53c639b45c0f26419f7a" args="() const " -->
179<div class="memitem">
180<div class="memproto">
181      <table class="memname">
182        <tr>
183          <td class="memname">bool CTSPSolver::isOptimal </td>
184          <td>(</td>
185          <td class="paramname"></td>
186          <td>&nbsp;)&nbsp;</td>
187          <td> const</td>
188        </tr>
189      </table>
190</div>
191<div class="memdoc">
192
193<p>Returns whether or not the solution is definitely optimal. </p>
194<dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if solution is definitely optimal, otherwise <code>false</code>.</dd></dl>
195<p>The solution may need some further interations to determine whether it is optimal. In such cases this function returns <code>false</code>. </p>
196
197</div>
198</div>
199<a class="anchor" id="abc4a62fa7954327949926473309d6bc3"></a><!-- doxytag: member="CTSPSolver::solve" ref="abc4a62fa7954327949926473309d6bc3" args="(int numCities, tMatrix task, QWidget *parent=0)" -->
200<div class="memitem">
201<div class="memproto">
202      <table class="memname">
203        <tr>
204          <td class="memname"><a class="el" href="structs_step.html">sStep</a> * CTSPSolver::solve </td>
205          <td>(</td>
206          <td class="paramtype">int&nbsp;</td>
207          <td class="paramname"> <em>numCities</em>, </td>
208        </tr>
209        <tr>
210          <td class="paramkey"></td>
211          <td></td>
212          <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>&nbsp;</td>
213          <td class="paramname"> <em>task</em>, </td>
214        </tr>
215        <tr>
216          <td class="paramkey"></td>
217          <td></td>
218          <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> *&nbsp;</td>
219          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
220        </tr>
221        <tr>
222          <td></td>
223          <td>)</td>
224          <td></td><td></td><td></td>
225        </tr>
226      </table>
227</div>
228<div class="memdoc">
229
230<p>Solves the given task. </p>
231<dl><dt><b>Parameters:</b></dt><dd>
232  <table border="0" cellspacing="2" cellpadding="0">
233    <tr><td valign="top"></td><td valign="top"><em>numCities</em>&nbsp;</td><td>Number of cities in the task. </td></tr>
234    <tr><td valign="top"></td><td valign="top"><em>task</em>&nbsp;</td><td>The matrix of city-to-city travel costs. </td></tr>
235    <tr><td valign="top"></td><td valign="top"><em>parent</em>&nbsp;</td><td>The parent widget for displaying messages and dialogs. </td></tr>
236  </table>
237  </dd>
238</dl>
239<dl class="return"><dt><b>Returns:</b></dt><dd>Pointer to the root of the solution tree.</dd></dl>
240<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000002">Todo:</a></b></dt><dd>TODO: Comment the algorithm. </dd></dl>
241
242<p><div class="dynheader">
243Here is the call graph for this function:</div>
244<div class="dynsection">
245<div class="center"><img src="class_c_t_s_p_solver_abc4a62fa7954327949926473309d6bc3_cgraph.png" border="0" usemap="#class_c_t_s_p_solver_abc4a62fa7954327949926473309d6bc3_cgraph_map" alt=""></div>
246<map name="class_c_t_s_p_solver_abc4a62fa7954327949926473309d6bc3_cgraph_map" id="class_c_t_s_p_solver_abc4a62fa7954327949926473309d6bc3_cgraph">
247<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"/>
248<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"/>
249<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"/>
250</map>
251</div>
252</p>
253
254</div>
255</div>
256<hr/>The documentation for this class was generated from the following files:<ul>
257<li>src/<a class="el" href="tspsolver_8h_source.html">tspsolver.h</a></li>
258<li>src/tspsolver.cpp</li>
259</ul>
260</div>
261<!--- window showing the filter options -->
262<div id="MSearchSelectWindow"
263     onmouseover="return searchBox.OnSearchSelectShow()"
264     onmouseout="return searchBox.OnSearchSelectHide()"
265     onkeydown="return searchBox.OnSearchSelectKey(event)">
266<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Defines</a></div>
267
268<!-- iframe showing the search results (closed by default) -->
269<div id="MSearchResultsWindow">
270<iframe src="" frameborder="0" 
271        name="MSearchResults" id="MSearchResults">
272</iframe>
273</div>
274
275<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Dec 7 18:11:39 2009 for TSPSG: TSP Solver and Generator by&nbsp;
276<a href="http://www.doxygen.org/index.html">
277<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
278</body>
279</html>
Note: See TracBrowser for help on using the repository browser.