listy paczek i regałów

This commit is contained in:
magdabiadala 2020-05-11 13:42:10 +02:00
parent 0dcc57ba93
commit 5dcaefe983
2 changed files with 18 additions and 0 deletions

View File

@ -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

16
main.py
View File

@ -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: