Using a genetic algorithm to calculate SAIFI

Artur Iskhakov on 22 Apr 2020
Latest activity Reply by Artur Iskhakov on 23 Apr 2020

Hello everyone! I'm trying to find an optimal placement for a recloser using the optimization toolbox. The best place to set a recloser is defined by minimal SAIFI (system average interruption frequency index) value. I've created a little function where Nt - total number of customers, G - are some weights characterizing power lines, Xi - number of interrupted customers (if interruption happens in i-th line AND it has a recloser in it), Mi - row of 1 and 0 (that genetic algorithm should use as a gene I guess...) Here's the code of function:

function [S] = SAIFI_sum (M)
Nt=270;
G = [1.1 1.2 1.3 1.4 1.5 1.6];
X = [270 30 220 180 60 70];
  for i=1:length(M)
      if  M(i)== 1
      N(i) = X(i);
  else
          N(i) = Nt;
      end
  end
  S = 0;
  for j=1:length(M)
      SAIFI(j) = N(j)*G(j);
      S = S + SAIFI(j);
  end
   S
end
As a result I have 51 same results: S = 297 and following message:
"Optimization running.
Objective function value: 297.0
Optimization terminated: average change in the fitness value less than options.FunctionTolerance".
I couldn't understand how to solve this problem.
Mary Fenelon
Mary Fenelon on 22 Apr 2020

The number of variables should be the dimension of M. Looks like that is 6 for your example. Also fill in the Bounds and Integer variable indices fields for all 6.

Look here for using the Optimization App for ga and here for more on ga with integer variables.

Artur Iskhakov
Artur Iskhakov on 23 Apr 2020

How can I accept this answer by the way?) I don't see an "accept" button)

Artur Iskhakov
Artur Iskhakov on 23 Apr 2020

Thank you so much!!! Now it's working!