forked from jlpacher/otimizador_alocacao_mkt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (33 loc) · 1.3 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from promo_scheduling.services.system_settings import get_system_settings
from promo_scheduling.services.promotion_service import PromotionService
from promo_scheduling.services.partner_service import PartnerService
from promo_scheduling.solver.solver import MechanicPartnerAssignmentSolver
from promo_scheduling.services.database import BigqueryDatabaseAdapter
from promo_scheduling.settings import conf
import yaml
def main():
with open("input.yaml", "r") as stream:
input_data = yaml.safe_load(stream)
print(input_data)
database_adapter = BigqueryDatabaseAdapter(
project=conf.database_project,
dataset_id=conf.database_dataset,
table_id=conf.database_table,
)
system_settings = get_system_settings(input_data)
partner_service = PartnerService.load_from_input(input_data)
promo_service = PromotionService.load_from_input(
partner_service=partner_service,
database_adapter=database_adapter,
)
solver = MechanicPartnerAssignmentSolver(
possible_promotions=promo_service.promotions,
partners=partner_service.partners,
system_settings=system_settings,
)
solver.run()
solver.print_solution()
solver.print_statistics()
solver.export_model("gitignore_model.txt")
if __name__ == "__main__":
main()