Changeset 9cf98b9bd6 in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Sep 2, 2009, 2:37:39 AM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
41d264adbd
Parents:
244c614c6b
Message:

+ Warning about possible non-optimal result.

  • Resulting path is now sorted, always starts from City 1 and has "City 1 -> City n -> ... -> City 1" format.
  • Translations updated.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    r244c614c6b r9cf98b9bd6  
    457457sStep *step = root;
    458458        n = 1;
    459 QString path = "";
    460459        while (n <= spinCities->value()) {
    461460                if (step->prNode->prNode != NULL || (step->prNode->prNode == NULL && step->plNode->prNode == NULL)) {
     
    467466                                output.append("<p>&nbsp;</p>");
    468467                        }
    469                         path += QString(" (%1,%2)").arg(step->candidate.nRow + 1).arg(step->candidate.nCol + 1);
    470468                }
    471469                if (step->prNode->prNode != NULL)
     
    476474                        break;
    477475        }
    478         output.append("<p>" + trUtf8("Optimal path:") + "</p>");
    479         output.append("<p>&nbsp;&nbsp;" + path + "</p>");
     476        if (solver.isOptimal())
     477                output.append("<p>" + trUtf8("Optimal path:") + "</p>");
     478        else
     479                output.append("<p>" + trUtf8("Resulting path:") + "</p>");
     480        output.append("<p>&nbsp;&nbsp;" + solver.getSortedPath() + "</p>");
    480481        output.append("<p>" + trUtf8("The price is <b>%1</b> units.").arg(step->price) + "</p>");
     482        if (!solver.isOptimal()) {
     483                output.append("<p>&nbsp;</p>");
     484                output.append("<p>" + trUtf8("<b>WARNING!!!</b><br>This result is a record, but it may not be optimal.<br>Iterations need to be continued to check whether this result is optimal or get an optimal one.") + "</p>");
     485        }
    481486        solutionText->setHtml(output.join(""));
    482487        solutionText->setDocumentTitle(trUtf8("Solution of Variant #%1 task").arg(spinVariant->value()));
Note: See TracChangeset for help on using the changeset viewer.