- Timestamp:
- Feb 17, 2010, 5:54:05 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/os.h
r87 r90 77 77 #define OS "Cygwin"ARCH 78 78 #define OSID quint8(4) 79 #elif defined Q_OS_DARWIN80 #define OS "Darwin OS"ARCH81 #define OSID quint8(5)82 79 #elif defined Q_OS_DGUX 83 80 #define OS "DG/UX"ARCH 84 #define OSID quint8( 6)81 #define OSID quint8(5) 85 82 #elif defined Q_OS_DYNIX 86 83 #define OS "DYNIX/ptx"ARCH 87 #define OSID quint8( 7)84 #define OSID quint8(6) 88 85 #elif defined Q_OS_FREEBSD 89 86 #define OS "FreeBSD"ARCH 90 #define OSID quint8( 8)87 #define OSID quint8(7) 91 88 #elif defined Q_OS_HPUX 92 89 #define OS "HP-UX"ARCH 93 #define OSID quint8( 9)90 #define OSID quint8(8) 94 91 #elif defined Q_OS_HURD 95 92 #define OS "GNU Hurd"ARCH 96 #define OSID quint8( 10)93 #define OSID quint8(9) 97 94 #elif defined Q_OS_IRIX 98 95 #define OS "SGI Irix"ARCH 99 #define OSID quint8(1 1)96 #define OSID quint8(10) 100 97 #elif defined Q_OS_LINUX 101 98 #define OS "Linux"ARCH 102 #define OSID quint8(1 2)99 #define OSID quint8(11) 103 100 #elif defined Q_OS_LYNX 104 101 #define OS "LynxOS"ARCH 102 #define OSID quint8(12) 103 #elif defined Q_OS_MAC 104 #define OS "Mac OS (Darwin)"ARCH 105 105 #define OSID quint8(13) 106 106 #elif defined Q_OS_MSDOS … … 122 122 #define OS "HP Tru64 UNIX"ARCH 123 123 #define OSID quint8(19) 124 #elif defined Q_OS_QNX 6125 #define OS "QNX RTP 6.1"ARCH124 #elif defined Q_OS_QNX 125 #define OS "QNX Neutrino"ARCH 126 126 #define OSID quint8(20) 127 #elif defined Q_OS_QNX128 #define OS "QNX"ARCH129 #define OSID quint8(21)130 127 #elif defined Q_OS_RELIANT 131 128 #define OS "Reliant UNIX"ARCH 132 #define OSID quint8(2 2)129 #define OSID quint8(21) 133 130 #elif defined Q_OS_SCO 134 131 #define OS "SCO OpenServer 5"ARCH 135 #define OSID quint8(2 3)132 #define OSID quint8(22) 136 133 #elif defined Q_OS_SOLARIS 137 134 #define OS "Sun Solaris"ARCH 135 #define OSID quint8(23) 136 #elif defined Q_OS_SYMBIAN 137 #define OS "Symbian"ARCH 138 138 #define OSID quint8(24) 139 139 #elif defined Q_OS_ULTRIX -
trunk/src/tspsolver.cpp
r89 r90 123 123 // Route with (nRow,nCol) path 124 124 right = new SStep(); 125 right->pNode = step; 125 126 right->matrix = step->matrix; 126 127 for (int k = 0; k < nCities; k++) { … … 137 138 // Route without (nRow,nCol) path 138 139 left = new SStep(); 140 left->pNode = step; 139 141 left->matrix = step->matrix; 140 142 left->matrix[nRow][nCol] = INFINITY; … … 183 185 { 184 186 if (root != NULL) 185 delete Node(root);187 deleteTree(root); 186 188 } 187 189 … … 215 217 mayNotBeOptimal = false; 216 218 if (root != NULL) 217 delete Node(root);219 deleteTree(root); 218 220 QApplication::restoreOverrideCursor(); 219 221 } 220 222 221 void CTSPSolver::deleteNode(SStep *&node) 222 { 223 //static int x; 224 // x++; 225 //qDebug() << ">>>" << x; 226 if (node->plNode != NULL) 227 deleteNode(node->plNode); 228 if (node->prNode != NULL) 229 deleteNode(node->prNode); 230 delete node; 231 node = NULL; 232 //qDebug() << "<<<" << x; 233 // x--; 223 void CTSPSolver::deleteTree(SStep *&root) 224 { 225 if (root == NULL) 226 return; 227 SStep *step = root; 228 SStep *parent; 229 forever { 230 if (step->plNode != NULL) { 231 // We have left child node - going inside it 232 step = step->plNode; 233 step->pNode->plNode = NULL; 234 continue; 235 } else if (step->prNode != NULL) { 236 // We have right child node - going inside it 237 step = step->prNode; 238 step->pNode->prNode = NULL; 239 continue; 240 } else { 241 // We have no child nodes. Deleting current one. 242 parent = step->pNode; 243 delete step; 244 if (parent != NULL) { 245 // Going back to the parent node. 246 step = parent; 247 } else { 248 // We came back to the root node. Finishing. 249 root = NULL; 250 break; 251 } 252 } 253 } 234 254 } 235 255 -
trunk/src/tspsolver.h
r89 r90 63 63 SCandidate candidate; //!< A candiadate for branching in the current matrix 64 64 QList<SCandidate> alts; //!< A list of alternative branching candidates 65 SStep *pNode; //!< Pointer to the parent step 65 66 SStep *plNode; //!< Pointer to the left branch step 66 67 SStep *prNode; //!< Pointer to the right branch step … … 69 70 SStep() { 70 71 price = -1; 71 p lNode = prNode = NULL;72 pNode = plNode = prNode = NULL; 72 73 } 73 74 }; … … 76 77 * \brief This class solves Travelling Salesman Problem task. 77 78 * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> 78 *79 * \todo TODO: Deletion of solution tree on destroy and cleanup.80 79 */ 81 80 class CTSPSolver … … 100 99 double align(TMatrix &matrix); 101 100 void cleanup(); 102 void delete Node(SStep *&node);101 void deleteTree(SStep *&root); 103 102 QList<SCandidate> findCandidate(const TMatrix &matrix, int &nRow, int &nCol) const; 104 103 double findMinInCol(int nCol, const TMatrix &matrix, int exr = -1) const; -
trunk/tspsg.pri
r87 r90 1 1 ###################################################################### 2 2 # 3 # TSPSG: TSP Solver and Generator4 # Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>3 # TSPSG: TSP Solver and Generator 4 # Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name> 5 5 # 6 # $Id$7 # $URL$6 # $Id$ 7 # $URL$ 8 8 # 9 # This file is part of TSPSG.9 # This file is part of TSPSG. 10 10 # 11 11 ###################################################################### -
trunk/tspsg.pro
r87 r90 1 1 ###################################################################### 2 2 # 3 # TSPSG: TSP Solver and Generator4 # Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>3 # TSPSG: TSP Solver and Generator 4 # Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name> 5 5 # 6 # $Id$7 # $URL$6 # $Id$ 7 # $URL$ 8 8 # 9 # This file is part of TSPSG.9 # This file is part of TSPSG. 10 10 # 11 11 ######################################################################
Note: See TracChangeset
for help on using the changeset viewer.