Issues with minimizing function using genetic algorithm.
조회 수: 4 (최근 30일)
이전 댓글 표시
I have an issue with trying to minimize the function in the code above using a genetic algorithm. The error I keep getting is shown below. mY call function is
M=[14000,15555,16000,17000,18000,19000;
14555,15555,16000,17555,18530,19000];
options = gaoptimset('InitialPopulation',M);
[x fval] = ga(@FuzzyForecast,6, options)
I would be glad if anyone could help.
Error using evalfismex
Illegal parameters in fisTriangleMf() --> a > b
Error in evalfis (line 83)
[output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
Error in FuzzyForecast (line 52)
u=evalfis(FLC_input,a);%evaluating output a.fis
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in fcnvectorizer (line 13)
y(i,:) = feval(fun,(pop(i,:)));
Error in makeState (line 58)
Score =
fcnvectorizer(state.Population(initScoreProvided+2:end,:),FitnessFcn,1,options.SerialUserFcn);
Error in gaunc (line 40)
state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ga (line 356)
[x,fval,exitFlag,output,population,scores] = gaunc(FitnessFcn,nvars, ...
Caused by:
Failure in user-supplied fitness function evaluation. GA cannot continue.
댓글 수: 2
답변 (1개)
Walter Roberson
2018년 9월 22일
You need to pass in linear inequalities that force your fis inputs to be sorted. For two variables near 1 that would look like
A = [1 -1]
b = -eps
댓글 수: 16
Walter Roberson
2018년 9월 23일
If you only have one input and one output, then your system could probably be addressed mathematically by using Linear Programming or at worst Quadratic Programming (depending upon the model formulas). Though it would be fair to want to try GA with a FIS to compare efficiency and accuracy.
One thing I can say is that your method of constructing FIS is really slow. There must be a lot of overhead or something like that.
To reduce that, I would suggest that you construct a FIS before the ga portion, stopping just before the addrule call. It looks to me as if this is not a handle object that is created -- otherwise you would not need to assign the output of the addrule() overtop of a. So you should be able to construct up to that point, pass the partly-constructed FIS into the objective function, and then have each objective call addrule() the appropriate specific rules to what would then effectively be a local copy of the FIS.
참고 항목
카테고리
Help Center 및 File Exchange에서 Fuzzy Inference System Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!