Olypmanel / delivery_robot

3 stars 0 forks source link

DELIVERY ROBOT

In the small Village of Know Where. The village is made of 13 houses (nodes) and 18 roads (edges) with distances (weights) which total to 404 kilometeers.

Each node is a House, or a company, or viewing center or shop. The edges are the roads that lead to those edges and the weights represents the distance of the roads in Kilometers.

The village is small with but the people in there are so lazy, that each person delivering his/her parcels to their neighbours seems pretty much like a big job even taking their mails to the Post office for delivery is no do. The citizens like to be alone doing what they like best, all best known to them.

The bellow Graph Image shows the whole map of the village.

the graph of know where village

HOW TO GET STARTED WITH THE DELIVERY ROBOT

THE ROBOTIC COMPANY AND THE ROBOTS

Even most Post Office officers ( Postmen ) seems lazy except me though 😂🤣 the manager of the Robot Brain Program ( RBP ) a subsidiary of Robotic Company ( RC ) the other is Robot Brawn Building ( RBB ) (they build the Robot Body). Which are all located beside the Post Office.

Our job in this company is to build robots that go to each house, shop etc, carry every parcel, goods, presents and deliver them at their respective addresses.

This takes the burden of the villagers taking their mails, parcels even presents and gifts to the Post Office and the postmen delivering them.

Since the launch of the first Robot. Both the postmen and the villagers have become more lazy.

Because all what the Villagers do is lodge in into the Robot App. ( Which was built by the RBB department ).
register their parcels, provide the location and the delivery address of the parcel.
Then the Robot after reading the registered parcels in Robotic App.

Firstly Robot decides to go out to the locations of every parcel and carry it. It might deliver some on the way but its aim is to first carry and gather all the parcels before trying to deliver them to their respective addresses. Normally, it cannot deliver what it hadn't carried. Secondly the Robot decides to go deliver all parcels at their respective addresses.

We've programmed four Robot's Brain so far.

  1. Random Route Robot ( R.R.R )
  2. Fixed Route Robot ( F.R.R )
  3. Route Generator Robot ( G.R.R )
  4. Shortest Route Robot ( S.R.R )

Random Route Robot ( R.R.R )

This is really an inefficient Robot in that:

  1. The Robot Brain was programmed based on the assumption that at one point in time the robot after wandering the whole village multiple times would get to location and address of the parcel.

  2. It implements the Math.random() function. This make it move to a random (or any ) location making it very unpredictable.

  3. Although, it had the data about the locations of the parcels and even the total number of parcel to be delivered, it did not have the memory about perfect route to get to its destination.

  4. It did not have the memory of its last visit for example it might move from Market to Farm and back several times (which is pretty, pretty far) before deciding to go somewhere else. Which would usually lead to great a number of turns and distance moved. Whereas other villagers would be waiting for parcels to picked or/and delivered.

  5. The above disadvantages usually lead to villagers not receiving their mails and parcels on time. This gave us thousands of negative feedbacks

Fixed Route Robot ( F.R.R )

This Robot Brain was developed to solve the negative feedback we were recieving from the villagers.
Normally, before the advent of any these robots. The postmen had a fixed route around the Village. This make their movement to be predicted ( The villagers knew where they would be at given time of the day).

All we did was make the Robot simulate this behaviour. The Robot would move around the Village two times. With the knowledge that it would carry, and gather the parcels in its first movement around the village and would deliver them the second time. These reduced the turns of the Robot to a maximun of 26 turns and 2 x 402 = 804 Kilometer distance.

Moreso, the Robot Brain make the Robot remember its previous visit and would know its next visit due to the memory installed but it could not get its own Route around the Village beacuase the route had been hard coded in its memory.

Although, the feedbacks from the villagers were positive at least they got the simulation of the postmen service, which make us happy for a while. But this would be cut short as new buildings (a lot of them --new Nodes--) were been built in the Village. The Village got advanced, more infrastructure. The map (Graph) of the Village got more advanced in terms of size.

These give even more problems than R.R.R in that:

  1. Because the Route of the robot was hard coded, we needed to update the Route on each building been built.
  2. New Villagers won't get to benefit from the Robot service if we the RBP wouldn't upadate the Robot's Route.
  3. The turns and distance of the Village had increased drastically. Therefore, we needed to rack our head further to get the perfect Route around the Village by doing a lot of surveys. Which were not guarranted to be accurate.
  4. At least the R.R.R would still run around the Village randomly and got the Job done with little or no update the F.R.R was not so (we needed to to update the Route for every bulding been built).

Still though the F.R.R would move at a much lesser turns and distance than R.R.R to get the Job under the same conditions.

This problem got us to the program room for new ideas.

Route Generator Robot (G.R.R)

After so much deep learning (I'm kidding right 😂🤣) we built a Robot Brain that could learn by it self (please flow with the vibe 😂). This Brain would later be one of the two most efficient Robot Brain. It learns by using the data of the Village map (graph). This Robot Brain was pretty advanced in that:

  1. It learns from the data of the Village given to it and add to the data on each visit to a building (or node ).
  2. It has memory of its last visit and know where its going and can generate the shortest route from its location to its destination. By implementing BFS or Level Order Search Algorithm
  3. It does this by considering each next house (node) as the closest entity without giving regards to their distances. (Which is a disavantage though, but an advantage over the earlier Robot Brain). This makes the Robot to make lesser turns than the previous Robot Brain.
  4. The Robot using this Brain generates its own Route to its destination without given much thought to the distance to be covered. At least it learns and decides and does the job without having a fixed or random route memory.

This was a mind blowing program which was almost perfect and was loved by the Villagers but it had a short coming. let's face it. A Robot that gives no regards to numbers (distances) is no efficient robot at all. This would lead us to program another Robot Brain to resolve this issue.

Shortest Route Robot (S.R.R)

S.R.R does what G.R.R does but better. It is currently the Robot used by the Know where Villagers. It generates shortest route to its destinaton from its location by considering each next house (node) and the distance between its location and these next houses (nodes).

This was so because the Robot implements BFS and Dijkstra's Algorithms. Making it the most efficient Robot Brain for now.

For example: Given a parcel at location of Market and delivery address to be Farm which is 100 kilometer far from each other. G.R.R will move thus:
Post Office ==> Market (carry the parcel) then head straight to Farm to deliver it. thus traveling a total distance of 105 Km and with 2 turnings.

S.R.R on the other hand will move thus:
Post Office ==> Market (carry the parcel) ==> Emmy's House then to Farm to deliver it. thus traveling a total distance of 23 km with 3 turnings.

The Know Where Villagers are praising us because we've solved their problem. And I'm Happy.