Implement the Travelling salesman problem
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Stefan Zeiter
il 31 Mar 2018
Risposto: Alan Weiss
il 2 Apr 2018
Hey
I would like to implement the branch and bound algorithm to solve the TSP. For achieving this task I found good inputs at this website: https://ch.mathworks.com/help/optim/examples/travelling-salesman-problem.html
Attached you can find my script. At the moment I get following error message:
>> TSP Error using optim.problemdef.OptimizationProblem/solve options is not a valid solver. Use 'linprog' or 'intlinprog' instead.
Error in TSP (line 71) tspsol = solve(tsp,'options',opts)
Could someone help me to solve this problem? I don't know where is the fault. I have also an additional question. Is my script working with the branch and bound algorithm? I would guess so because the scripts contains constraints and subconstraints. But I'm not sure...
Best
3 Commenti
Risposta accettata
John D'Errico
il 31 Mar 2018
Modificato: John D'Errico
il 31 Mar 2018
Your problem is here:
tspsol = solve(tsp,'options',opts)
which should be:
tspsol = solve(tsp,opts)
tspsol =
struct with fields:
trips: [19900×1 double]
As you can see, my release (also R2017b) has no problem.
3 Commenti
John D'Errico
il 1 Apr 2018
NO. You do NOT define a variable named updateSalesmanPlot. That is expected to be a function. When you created it as a variable, it tries to index into the variable, instead of calling a function by that name.
Più risposte (1)
Alan Weiss
il 2 Apr 2018
From the example that you mentioned click the "Try this example" button in MATLAB (not in your browser). This will take your MATLAB to the appropriate folder, containing the updateSalesmanPlot function, so MATLAB can find it.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Commenti
Vedere anche
Categorie
Scopri di più su Traveling Salesman (TSP) in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!