Borrar filtros
Borrar filtros

Issues with minimizing function using genetic algorithm.

4 visualizaciones (últimos 30 días)
Honey Adams
Honey Adams el 22 de Sept. de 2018
Comentada: Walter Roberson el 23 de Sept. de 2018
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 comentarios
Stephan
Stephan el 22 de Sept. de 2018
Editada: Stephan el 22 de Sept. de 2018
You do not bound the values for x1...x6 with upper and lower bounds when calling ga. Maybe this causes an error when the function tries to calculate the fuzzy system, for example if some x values get less then zero.
Honey Adams
Honey Adams el 22 de Sept. de 2018
I tried that but had the same errors.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Sept. de 2018
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 comentarios
Honey Adams
Honey Adams el 23 de Sept. de 2018
The problem is from me actually. I am trying to figure out how to correct it. I am implementing a fuzzy time series forecast using the genetic algorithm. The problem starts with the logical relationships I developed.
Walter Roberson
Walter Roberson el 23 de Sept. de 2018
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Fuzzy Inference System Modeling en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by