From ab60f1f4203a9e1207c061ea03d47c7525b9d48c Mon Sep 17 00:00:00 2001 From: M3L4O Date: Fri, 24 Mar 2023 09:33:57 -0300 Subject: [PATCH] reestruturando arquivos novamente #52 --- .../application/ComponentSugestor/sugestor.py | 59 ------------------- src/framework/domain/components.py | 15 ----- src/framework/domain/exception.py | 5 -- 3 files changed, 79 deletions(-) delete mode 100644 src/framework/application/ComponentSugestor/sugestor.py diff --git a/src/framework/application/ComponentSugestor/sugestor.py b/src/framework/application/ComponentSugestor/sugestor.py deleted file mode 100644 index d4b5d7c..0000000 --- a/src/framework/application/ComponentSugestor/sugestor.py +++ /dev/null @@ -1,59 +0,0 @@ -from enum import Enum - -from framework.domain.components import EComponentType, Component - - -class EComputerPurposes(Enum): - GAMING = 0 - STUDYING = 1 - PROGRAMMING = 2 - WEB_BROWSING = 3 - - -_component_priorities = { - EComputerPurposes.GAMING: { - EComponentType.GPU: 1, - EComponentType.CPU: 0.8, - EComponentType.RAM: 0.7, - EComponentType.PERSISTENCE: 0.5, - }, - EComputerPurposes.STUDYING: { - EComponentType.GPU: 0.2, - EComponentType.CPU: 1, - EComponentType.RAM: 0.7, - EComponentType.PERSISTENCE: 0.6, - }, - # TODO completar o dicionário com as prioridades -} - -_component_specs_priorities = { - EComponentType.GPU: { - "vram": 1, - "consumption": 0.8, - }, - EComponentType.CPU: { - "base_clock_spd": 1, - "n_cores": 0.7, - "ram_clock_max": 0.7, - "consumption": 0.5, - } - # TODO completar o dicionário com as prioridade de especificações -} - - -class ComponentSugestor: - def __init__(self, budget: float, purpose: EComputerPurposes): - self.budget = budget - self.purpose = purpose - - def generate_computer() -> dict[EComponentType, Component]: - # TODO restringe o custo por componente. - # TODO define custo estimado para PS - # TODO Fitra componentes abaixo de seus custos limite. - # TODO if prioridade GPU == 0, filtrar CPUS com GPU integrada - # TODO calcula sua 'pontuação' com base na prioridade de suas especificações. - # TODO Executa problema da mochila, restringindo com base na compatibilidade. - # TODO somar consumo total e definir fonte com o orçamento estabelecido. - # TODO caso o orçamento não seja totalmente preenchido, aumentar o orçamento do item prioritário, mantendo as compatibilidades anteriores - - pass diff --git a/src/framework/domain/components.py b/src/framework/domain/components.py index a819673..345d839 100644 --- a/src/framework/domain/components.py +++ b/src/framework/domain/components.py @@ -3,7 +3,6 @@ from typing import List from .entity import Entity -from .exception import KnapsackBurst __all__ = [ "Component", @@ -221,20 +220,6 @@ class PSUComponent(Component): modularity: EPSUModularity -@dataclass -class Knapsack(Entity): - components: list[Component] - max_price: Money - current_price: Money - - def push(self, component: Component, price: Money): - if self.current_price + price > self.max_price: - raise KnapsackBurst() - - # TODO checar restrições - self.components.append(component) - - component_cls_idx = [ Component, MotherboardComponent, diff --git a/src/framework/domain/exception.py b/src/framework/domain/exception.py index 6d501e0..964a20a 100644 --- a/src/framework/domain/exception.py +++ b/src/framework/domain/exception.py @@ -11,11 +11,6 @@ def __repr__(self): return f"{self.__class__.__name__}: {self._message}" -@dataclass -class KnapsackBurst(DomainException): - _message: str = "A bolsa atingiu o limite de preço." - - @dataclass class CurrencyNotEqual(DomainException): _message: str = "As moedas são diferentes"