Place Objective Functions on the same scale(0,1)?

Asked

Viewed 27 times

0

I have this code for the generation of fitness function, but I need the values resulting from F1, F2 and F3 functions to be calculated in such a way that their values are always on the same scale as (0.1).

    # objetivo 1 - minimize - f1
  def f1(self):
      return self.M/K   

  # objetivo 2 - maximize - f2
  def f2(self):
      try:
        return 1/(N*k)*self.somatorio_covCost_s[0]
      except ValueError as e:
        print(e)   

  # objetivo 3 - maximize - f3 
  def f3(self): 
      v_f3=0
      try:
        v_f3=1/(self.M*m)*self.somatorio_connCost_s[0]         
      except ValueError as e:
        print(e)
      return v_f3


  def ffitness(self):
    peso = pesos()
    w1 = peso[0]
    w2 = peso[1]
    w3 = peso[2]

    f=w1*(1.0 - self.f1())+w2*(self.f2())+w3*(self.f3())
    print("F1(Minimize):",self.f1())
    print("F2(Maximize):",self.f2())
    print("F3(Maximize):",self.f3())
    print("Pesos: w1:"+str(w1)+" "+"w2:"+str(w2)+" "+"w3:"+str(w3))
    print("Resultado da Função Fitness:",f)

    self.fitness=f
    #return f   
  • Can make a [mcve] demonstrating the code working?

  • I’m too long to put Aki. As a result of this): F1(Minimize): 0.6 F2(Maximize): 2.7, F3(Maximize): 2.0 ,Weights: w1:0.3447301953796229 w2:0.2582778887500879 W3:0.39699191587028, Fitness Function Result: 1.6292262095176 Function result fitness ñ could give >1, and for that it needed that the values of F1,F2,F3 functions were in the scale(0,1).

  • But is the calculation correct? I don’t see much point in forcing the scale change just because the result should be less than 1.

  • Yes, the calculation is correct. I want to do this because generally, these three values have different scale scales and the higher range value always dominates the overall adequacy value. Thus, to give equal importance to the three individual objectives, their values must be adjusted within the same scale. The part of the smaller being that I didn’t really understand, I will study and go back to who guided me to understand, but every precise way that the values are in the scale.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.