Changeset 430bd7f7e9 in tspsg for src/tspmodel.cpp
- Timestamp:
- Jul 31, 2009, 8:23:07 PM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- ec54b4490b
- Parents:
- b5c9bcb585
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tspmodel.cpp
rb5c9bcb585 r430bd7f7e9 1 1 /* 2 * TSPSG -TSP Solver and Generator2 * TSPSG: TSP Solver and Generator 3 3 * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 4 4 * … … 119 119 return; 120 120 emit layoutAboutToBeChanged(); 121 if (n > nCities) { 122 for (int r = 0; r < nCities; r++) { 123 for (int c = nCities; c < n; c++) 124 if (r == c) 125 table[r][c] = INFINITY; 126 else 127 table[r][c] = 0; 128 } 129 for (int r = nCities; r < n; r++) { 130 for (int c = 0; c < n; c++) 131 if (r == c) 132 table[r][c] = INFINITY; 133 else 134 table[r][c] = 0; 135 } 136 } 121 table.resize(n); 122 for (int k = 0; k < n; k++) { 123 table[k].resize(n); 124 } 125 if (n > nCities) 126 for (int k = nCities; k < n; k++) 127 table[k][k] = INFINITY; 137 128 nCities = n; 138 129 emit layoutChanged(); … … 148 139 } 149 140 150 inline bool CTSPModel::loadError(QDataStream::Status status) const141 inline bool CTSPModel::loadError(QDataStream::Status status) 151 142 { 152 143 QString err; … … 257 248 // Costs 258 249 double val; 259 for (int r = 0; r < size; r++)260 for (int c = 0; c < size; c++)261 if ( r != c) {250 for (int r = 0; r < 5; r++) 251 for (int c = 0; c < 5; c++) 252 if ((r != c) && (r < size)) { 262 253 ds->readRawData(reinterpret_cast<char *>(&val),8); 263 254 if (loadError(ds->status())) {
Note: See TracChangeset
for help on using the changeset viewer.