Not enough input arguments

3 views (last 30 days)
aicha mabrouk
aicha mabrouk on 1 Dec 2016
Commented: aicha mabrouk on 1 Dec 2016
Hi, I'm very new to MATLAB and am having some trouble. Could somebody please fix this error. thanks
  2 Comments
Jorrit Montijn
Jorrit Montijn on 1 Dec 2016
If you want any help, you'll have to do more than just vomit your scripts onto the internet. Can you post what you're trying to do, what the error message is, the relevant part of the code you've made, and what you've tried so far?
aicha mabrouk
aicha mabrouk on 1 Dec 2016
I'm trying to implement the algorithm of a colony of ants in Tsp

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 1 Dec 2016
aicha - when I run your main script, I observe the following error
Undefined function 'Ulim' for input arguments of type 'double'.
Error in PlotSolution (line 25)
Ulim([Umin Umax]);
Error in aco (line 114)
PlotSolution(BestSol.Tour,model);
Error in main (line 3)
aco;
In PlotSolution, there is no mention of Ulim (or Vlim) so I can't help but wonder if yu are wanting to do an assignment here instead:
Ulim = [Umin Umax];
Even that might not be the case since this (and Vlim) are not referenced later in the code. Please clarify what you are trying to do here.
In the same function, there is also an error with
Vmax = ceil((Vmau + alpha*dV)/10)*10;
Vmau is undefined so I suspect (given what you have done for Umax) you want to do something like
Vmax = ceil((Vmax + alpha*dV)/10)*10;
When posting questions with errors, please show what code you are calling which leads to the error. We need to be able to reproduce exactly what steps you are following in order to reproduce the bug. And please copy and paste the full error message.
Note that with the above code changes, I am able to run your code as
>> main
entrez le nombre de villages5
entrez nbre iteration100
Iteration 1: Best Cost = 1.6846
Iteration 2: Best Cost = 1.6846
Iteration 3: Best Cost = 1.6846
Iteration 4: Best Cost = 1.6846
% etc.
So I chose 5 villages (colonies?) and their positions within the axes before choosing 100 iterations.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!