Download the PHP package ggggino/warehouse-path without Composer
On this page you can find all versions of the php package ggggino/warehouse-path. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ggggino/warehouse-path
More information about ggggino/warehouse-path
Files in ggggino/warehouse-path
Package warehouse-path
Short Description Find the shortest path to retrieve all the objects in the own location
License MIT
Informations about the package warehouse-path
GGGGinoWarehousePath
Find the shortest path to retrieve all the objects in the own location
Get started
Initialization from a give matrix
Initialization from a give tree
Initialization from a json
Here for a correct json used to build the warehouse
Initialization in detail
Get distance from a starting point to every other location
Get the matrix of proximity
Call the Warehouse::getPath for every single location passed in the array
Best path
Calculate the best path to touch every location from the matrix of proximity
With this function you get the best path to follow to touch every location in the warehouse/matrix.
Places
Places are the main factor for calculating the best path from a Point A to B.
A warehouse can be seen as a matrix of Place that every item has own weight. From this, the program can create the best path:
Lx = Location - Weight 1
Wx = Wall - Weight 100
Cx = Corridor - Weight 2
L1 | W1 | L8 |
---|---|---|
L2 | W2 | L7 |
L3 | C1 | L6 |
L4 | C2 | L5 |
Imagine you start from the Place "L1", the best path to "L7" will be:
L1 -> L2 -> L3 -> C1 -> L6 -> L7
So the distance, adding all the weight in the path, will be:
1 + 1 + 1 + 2 + 1 = 6
This library starts with these three places:
Name | Weight | Walkable |
---|---|---|
Corridor | 2 | true |
Location | 1 | true |
Wall | 100 | false |
You can add as many type of Place as you want.
Read the complete doc about Places
Breadcrumb builder
The breadcrumb builder aim to create a matrix from the array of all places. This matrix will be passed to the calculator that calculate the correct order which is the correct path to touch all the places with the less cost possible.
Breadth First
With this method I map the wharehouse expanding the area and keep in mind the previous state on every step. In this way I can realize a wharehouse that every place knows the shortest path to specific point
Read the complete doc about Breadcrumb
Calculators
The calculator is the method that choose the best order to touch every location listed. At the moment only one type of calculation is available.
Fast calculator
In the matrix builded from the distance between every location, I chose for every location the closer location.
Read the complete doc about Calculators