Skip to content

Commit

Permalink
Classe para algoritmos de descida
Browse files Browse the repository at this point in the history
Implementada classe IProblemaDescida para algoritmos de descida.
  • Loading branch information
LBBassani committed Sep 23, 2019
1 parent 59645fb commit 088c8e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion IProblema.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,9 @@ def construcaoGulosa(self, estado, m, semente):
estado.extend(melhor)

def buscaLocal(self, estado, metodoBuscaLocal, **keyargs):
self.busca(estado, metodoBusca= metodoBuscaLocal, **keyargs)
self.busca(estado, metodoBusca= metodoBuscaLocal, **keyargs)

class IProblemaDescida(IProblema):
def escolheMelhores(self, estado, estados):
resp = list(filter(lambda x: self.melhorEstado([x, estado] == x), estados))
return resp
2 changes: 1 addition & 1 deletion mochila.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math as m
import IProblema as interface

class mochila(interface.IProblemaGRASP, interface.IProblemaSimulatedAnnealing, interface.IProblemaGenetico, interface.IProblema):
class mochila(interface.IProblemaDescida, interface.IProblemaGRASP, interface.IProblemaSimulatedAnnealing, interface.IProblemaGenetico, interface.IProblema):

def __init__(self, valores, maxTam, metodoBusca = None):
# valores da mochila: O valor do elemento está em 0 e o volume em 1
Expand Down

0 comments on commit 088c8e4

Please sign in to comment.