This file contains hidden or 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
def guloso(produto,preco,peso,mochila_capacidade): | |
naMochila = [] | |
lucro = 0 | |
while True: | |
maiorPreco = 0 | |
index = None | |
for i in range(len(produto)): | |
if (preco[i] > maiorPreco) & (produto[i] not in naMochila) & (mochila_capacidade >= peso[i]): | |
maiorPreco = preco[i] |
This file contains hidden or 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
def pd(processo,mudanca): | |
linhas = len(mudanca) | |
colunas = len(mudanca[0]) | |
nProcessos = len(processo[0]) | |
# Cria a matriz de custos | |
custo = [[None for i in range(colunas)] for x in range(linhas)] | |
# Cria a matriz de caminhos | |
caminho = [[None for i in range(nProcessos)] for x in range(linhas)] |
NewerOlder