Changeset 89 in tspsg-svn for trunk/src/tspsolver.cpp
- Timestamp:
- Jan 12, 2010, 4:27:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tspsolver.cpp
r87 r89 106 106 int nRow, nCol; 107 107 bool firstStep = true; 108 qrealcheck;108 double check; 109 109 while (this->route.size() < nCities) { 110 110 // forbidden.clear(); … … 188 188 /* Privates **********************************************************/ 189 189 190 qrealCTSPSolver::align(TMatrix &matrix)191 { 192 qrealr = 0;193 qrealmin;190 double CTSPSolver::align(TMatrix &matrix) 191 { 192 double r = 0; 193 double min; 194 194 for (int k = 0; k < nCities; k++) { 195 195 min = findMinInRow(k,matrix); … … 240 240 QList<SCandidate> alts; 241 241 SCandidate cand; 242 qrealh = -1;243 qrealsum;242 double h = -1; 243 double sum; 244 244 for (int r = 0; r < nCities; r++) 245 245 for (int c = 0; c < nCities; c++) … … 261 261 } 262 262 263 qrealCTSPSolver::findMinInCol(int nCol, const TMatrix &matrix, int exr) const264 { 265 qrealmin = INFINITY;263 double CTSPSolver::findMinInCol(int nCol, const TMatrix &matrix, int exr) const 264 { 265 double min = INFINITY; 266 266 for (int k = 0; k < nCities; k++) 267 267 if ((k != exr) && (min > matrix.at(k).at(nCol))) … … 270 270 } 271 271 272 qrealCTSPSolver::findMinInRow(int nRow, const TMatrix &matrix, int exc) const273 { 274 qrealmin = INFINITY;272 double CTSPSolver::findMinInRow(int nRow, const TMatrix &matrix, int exc) const 273 { 274 double min = INFINITY; 275 275 for (int k = 0; k < nCities; k++) 276 276 if (((k != exc)) && (min > matrix.at(nRow).at(k))) … … 293 293 } 294 294 295 void CTSPSolver::subCol(TMatrix &matrix, int nCol, qrealval)295 void CTSPSolver::subCol(TMatrix &matrix, int nCol, double val) 296 296 { 297 297 for (int k = 0; k < nCities; k++) … … 300 300 } 301 301 302 void CTSPSolver::subRow(TMatrix &matrix, int nRow, qrealval)302 void CTSPSolver::subRow(TMatrix &matrix, int nRow, double val) 303 303 { 304 304 for (int k = 0; k < nCities; k++)
Note: See TracChangeset
for help on using the changeset viewer.