Changeset 394216e468 in tspsg for src/tspsolver.h
- Timestamp:
- Mar 22, 2010, 9:45:16 PM (14 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 1babbd6ba3
- Parents:
- e2abfd326f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tspsolver.h
re2abfd326f r394216e468 78 78 * \author Copyright © 2007-2010 Lёppa <contacts[at]oleksii[dot]name> 79 79 */ 80 class CTSPSolver 80 class CTSPSolver: public QObject 81 81 { 82 Q_ DECLARE_TR_FUNCTIONS(CTSPSolver)82 Q_OBJECT 83 83 84 84 public: 85 CTSPSolver(); 85 static QString getVersionId(); 86 87 CTSPSolver(QObject *parent = NULL); 88 void cleanup(bool processEvents = false); 86 89 QString getSortedPath() const; 87 static QString getVersionId();88 90 bool isOptimal() const; 89 SStep *solve(int numCities, TMatrix task, QWidget *parent = 0); 91 SStep *solve(int numCities, const TMatrix &task); 92 bool wasCanceled() const; 90 93 ~CTSPSolver(); 91 94 95 public slots: 96 void cancel(); 97 98 signals: 99 /*! 100 * \brief This signal is emitted once every time a part of the route is found. 101 * \param n Indicates the number of the route parts found. 102 */ 103 void routePartFound(int n); 104 92 105 private: 93 bool mayNotBeOptimal ;106 bool mayNotBeOptimal, canceled; 94 107 int nCities; 95 108 SStep *root; 96 109 QHash<int,int> route; 97 // QHash<int,int> forbidden;110 mutable QMutex mutex; 98 111 99 112 double align(TMatrix &matrix); 100 void cleanup();101 void de leteTree(SStep *&root);113 void deleteTree(SStep *&root, bool processEvents = false); 114 void denormalize(TMatrix &matrix) const; 102 115 QList<SCandidate> findCandidate(const TMatrix &matrix, int &nRow, int &nCol) const; 103 116 double findMinInCol(int nCol, const TMatrix &matrix, int exr = -1) const; 104 117 double findMinInRow(int nRow, const TMatrix &matrix, int exc = -1) const; 105 118 bool hasSubCycles(int nRow, int nCol) const; 119 void normalize(TMatrix &matrix) const; 106 120 void subCol(TMatrix &matrix, int nCol, double val); 107 121 void subRow(TMatrix &matrix, int nRow, double val); … … 110 124 #ifdef DEBUG 111 125 QDebug operator<<(QDebug dbg, const TMatrix &matrix); 112 #endif 126 QDebug operator<<(QDebug dbg, const SCandidate &candidate); 127 #endif // DEBUG 113 128 114 129 #endif // TSPSOLVER_H
Note: See TracChangeset
for help on using the changeset viewer.