Optimization of trips to the store

Hello everyone! Usually, when I collect my shopping cart at the supermarket, I pick up the groceries one at a time in the order they appear on the list. Recently, I was walking through the store and, turning another circle in search of a product that lies in the department where I have already been, I thought it would be possible to save a lot of time by making a list so that, collecting products in a row, I would follow the optimal route, without making any mental effort. At first I wanted to compile a list in advance in this way, but it is difficult and uninteresting, so I decided to automate this process and this is what came of it:





: (, ..) , , , , . . - , , -.





:









, . :









x





y













15





3





, ,









15





2













7





4













1





4





, ,





, – , , . , , , . . -, - – , . -, -, , .





: . - , , , . , , . , '' '' '' '', , , .





Navec. 500 , , . , 300 .





, , . : '' '' . , :





{'': [''],

'': [''],

'': [''],

'//': ['', ''],

'': ['', ''],

'': ['', ''],

'/': ['', ''],

'': [''],

'': ['', '']}





, , .





2 3 M , M(i,j) i j. :





Adjacency matrix

, , . 11 .





. - , .. , . . , 4 , . .





. A n ⨉ 2ⁿ n - . , , , . .





. A(5,1105) = 10. 1105 10001010001, 1, 5, 7 11, . 5 - , №5. , 1,5,7 11 5 10.





, — , . , , .. , .. .





, , 1 2 , 15 . 15 1101. 1,2 4, 1.





A (1.1101_2) = min (M (1.2) + A (2.0101_2), M (1.4) + A (4.0101_2))

2 , M(1,2) + A(2, 5) M(1,4) + A(4, 5). 5 , 0101 . . , , .





Decision matrix

. , . .





. , , , . .





Path containing the frost section
,
Way through the same departments, but without frost
,

. , , .





-

- , .





google cloud platform, Debian, :

- python3 – ,

- git – ,

- mySQL – ,

- tmux – ssh-.

api aiogram.





3 : /del# - # /clear - /sort -





, .





user_xxxxxxxx, xxxxxxxx - id , , .





Here is the result, thanks for reading to the end, a link to the project on github .








All Articles