Changeset aaf2113307 in tspsg for src/tspsolver.cpp


Ignore:
Timestamp:
Aug 3, 2009, 5:15:46 PM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
f44855d99e
Parents:
e96fad3079
Message:

+ Implemented File/Save? action.
+ Added "Save Solution" and "Back to Task" buttons to Solution tab for better usability.

  • Increased maximum number of cities to 20. Solving for 18-20 cities is already takes much time, so I thought it doesn't make sense to increase more.
  • Columns and rows are now resized to contents on all platforms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tspsolver.cpp

    re96fad3079 raaf2113307  
    9797        for (int r = 0; r < nCities; r++)
    9898                for (int c = 0; c < nCities; c++)
    99                         if ((matrix[r][c] == 0) && !forbidden.values(r).contains(c)) {
     99//                      if ((matrix[r][c] == 0) && !forbidden.values(r).contains(c)) {
     100                        if (matrix[r][c] == 0) {
    100101                                sum = findMinInRow(r,matrix,c) + findMinInCol(c,matrix,r);
    101102                                if (sum > h) {
     
    154155int nRow, nCol;
    155156        while (route.size() < nCities) {
    156                 forbidden.clear();
     157//              forbidden.clear();
    157158                step->alts = findCandidate(step->matrix,nRow,nCol,s);
    158159                while (hasSubCycles(nRow,nCol)) {
    159                         forbidden[nRow] = nCol;
     160//                      forbidden[nRow] = nCol;
    160161                        step->matrix[nRow][nCol] = INFINITY;
    161162                        step->price += align(step->matrix);
     
    204205        }
    205206
    206         pd.reset();
     207        if (!root && !pd.wasCanceled()) {
     208                pd.reset();
     209                QMessageBox(QMessageBox::Warning,trUtf8("Solution Result"),trUtf8("Unable to find solution.\nMaybe, this task has no solutions."),QMessageBox::Ok,parent).exec();
     210        }
     211
    207212        qApp->processEvents();
    208213
    209         if (!root && !pd.wasCanceled()) {
    210                 QMessageBox(QMessageBox::Warning,trUtf8("Solution Result"),trUtf8("This task has no solution."),QMessageBox::Ok,parent).exec();
    211         }
    212 
    213214        return root;
    214215}
Note: See TracChangeset for help on using the changeset viewer.