Not enough input arguments

조회 수: 3 (최근 30일)
aicha mabrouk
aicha mabrouk 2016년 12월 1일
댓글: aicha mabrouk 2016년 12월 1일
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.
  댓글 수: 1
aicha mabrouk
aicha mabrouk 2016년 12월 1일
thank you so much it works.

댓글을 달려면 로그인하십시오.

추가 답변 (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