-
-
Save johntheo/dcd65db029bb94c7207df82dd5bc924c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# funcao de fitness | |
def evaluate(individual): | |
l = int("".join(str(i) for i in individual[:int(IND_SIZE/GENES)]), 2) # gene quantidade de garrafas de leite | |
s = int("".join(str(i) for i in individual[int(IND_SIZE/GENES):]), 2) # gene quantidade de garrafas de suco | |
g = (5 * l + 4.5 * s) / 9718.5 # funcao objetivo normalizada [0,1] | |
h1 = max(0, ((6 * l + 5 * s) / 100 - 60)) / 52.53 # funcao de restricao 1 normalizada [0,1] | |
h2 = max(0, (10 * l + 20 * s - 15000)) / 15690 # funcao de restricao 2 normalizada [0,1] | |
h3 = max(0, (l - 800)) / 223 # funcao de restricao 3 normalizada [0,1] | |
h4 = max(0, (s - 750)) / 273 # funcao de restricao 4 normalizada [0,1] | |
return g - 2*(h1+h2+h3+h4)/4, # fitness normalizado [0,1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment