This commit is contained in:
andrzej 2020-05-11 13:45:33 +02:00
commit e6a68c5f04
2 changed files with 18 additions and 0 deletions

View File

@ -1,6 +1,8 @@
import random import random
import math import math
# packs_coords
# racks_coords
### prawdopodobieństwo mutacji ### prawdopodobieństwo mutacji
mutation_prob = 0.03 mutation_prob = 0.03
### ilość osobników w pokoleniu, powinna być parzysta ### ilość osobników w pokoleniu, powinna być parzysta

16
main.py
View File

@ -1,10 +1,16 @@
import pygame import pygame
import warehouse import warehouse
import agent import agent
from genetic_algorithm import gen_alg
import random import random
import sys import sys
from attributes import PackStatus, COLORS, DIRECTION_ANGLES 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) WINDOW_SIZE = (640, 640)
COLOR_OF_FIELD = { COLOR_OF_FIELD = {
'Floor': 'gray', 'Floor': 'gray',
@ -30,6 +36,16 @@ class MainGameFrame:
starting_x, starting_y = self.set_starting_agent_position() starting_x, starting_y = self.set_starting_agent_position()
self.agent = agent.Agent(starting_x, starting_y, self.warehouse_map, agent_radius) self.agent = agent.Agent(starting_x, starting_y, self.warehouse_map, agent_radius)
self.clock = pygame.time.Clock() 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): def run(self):
while True: while True: