Not enough input arguments

3 次查看(过去 30 天)
Hi, I'm very new to MATLAB and am having some trouble. Could somebody please fix this error. thanks
  2 个评论
Jorrit Montijn
Jorrit Montijn 2016-12-1
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 2016-12-1
I'm trying to implement the algorithm of a colony of ants in Tsp

请先登录,再进行评论。

采纳的回答

Geoff Hayes
Geoff Hayes 2016-12-1
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by