From 5dcaefe98306e5f2ccd08826b2b1e3e71f96bf8e Mon Sep 17 00:00:00 2001 From: magdabiadala Date: Mon, 11 May 2020 13:42:10 +0200 Subject: [PATCH] =?UTF-8?q?listy=20paczek=20i=20rega=C5=82=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genetic_algorithm.py | 2 ++ main.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/genetic_algorithm.py b/genetic_algorithm.py index b2ef21f..c4b5d7b 100644 --- a/genetic_algorithm.py +++ b/genetic_algorithm.py @@ -1,6 +1,8 @@ import random import math +# packs_coords +# racks_coords ### prawdopodobieństwo mutacji mutation_prob = 0.03 ### ilość osobników w pokoleniu, powinna być parzysta diff --git a/main.py b/main.py index 638dac3..d828dfb 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,16 @@ import pygame import warehouse import agent +from genetic_algorithm import gen_alg import random import sys from attributes import PackStatus, COLORS, DIRECTION_ANGLES +mutation_prob = 0.03 +generation_size = 20 +number_of_generations = 30 +amount_of_promotion = 3 + WINDOW_SIZE = (640, 640) COLOR_OF_FIELD = { 'Floor': 'gray', @@ -30,6 +36,16 @@ class MainGameFrame: starting_x, starting_y = self.set_starting_agent_position() self.agent = agent.Agent(starting_x, starting_y, self.warehouse_map, agent_radius) self.clock = pygame.time.Clock() + packs_coords = [(pack.lays_on_field.x_position, pack.lays_on_field.y_position) for pack in self.warehouse_map.packages] + list_of_racks = self.warehouse_map.get_all_racks(True) + racks_coords = [(line.x_position, line.y_position) for line in list_of_racks] + packs_sizes = [pack.size for pack in self.warehouse_map.packages] + # racks_capacities = [pack.size for pack in self.warehouse_map.packages] + print("koordynaty paczek: ",packs_coords) + print("koordynaty regałów: ",racks_coords) + print("wagi paczek: ",packs_sizes) + # print("pojemności regałów: ",racks_capacities) + gen_alg(number_of_generations, generation_size, mutation_prob, amount_of_promotion) def run(self): while True: