Reputation: 2183
I have to do the following. Node T1 is waiting for some item from the layer above. Once it is received, it has to transfer the content to the layer below.
Restrictions: Layer T1 and B1 can move horizontally, however, nodes at layer I1x and layers I2x cannot move.
T1 can move horizontally to transfer content to I11, I12 or I13. Once the content is in I11, I12 or I13 it can be transferred only to I21, I22 or I23 respectively. This means if there is content in I11 it can only go to I21 if it free. If I21 is not free, content has to wait in node I11. B1 which can move horizontally to get content from I21, I22 or I23.
Content needs to be transferred from T1 to I11, I12 or I13 depending upon which one is free. I12 is always the ideal choice.
Once content is available at layer I2x, Bottom layer B1 can move and get the content from I2x. The final objective is to transfer items from T1 to B1. From B1 some human will collect the items which were processed.
The intermediate layers have been added to improve efficiency. If there were no intermediate nodes, only two items can be ready at any point in time. This way, we can have 8 items ready if none is picked up. Once items are available, a human can collect it from B1 and items from the layer I2x to B1 and I1x to I2x in succession.
If I have to implement this programmatically, what is the best approach to solving this problem? Someone from my team suggested Finite state machine, however, I am not fully convinced by the idea. If FSM is the right choice, any pointers on how to achieve it?
Edit 1: Items from I21, I22, and I23 must be taken out sequentially. This is necessary because if something is given priority - for example I22, then if the system produces output at a rate faster than a human can take out from B1, items will be taken out from I22 only even though I21 and I23 are already filled. This way, I21, and I23 will never be empty. For this, we can give B1 node the liberty to decide from which node it wants to fetch the items.
Upvotes: 0
Views: 135
Reputation: 3207
You should be more specific with your requirements.
For simulating the node transitions of one item, FSM is fine. However I assume that by "solving" you mean finding some optimal scheduling of T1 and B1? Or can T1 just assign items to the first free slot?
Also do the edges (transfers between nodes) have some cost/time/delay that you need to simulate? Do you need to simulate many items going through the system?
All of this needs to be clearly specified before implementing. :) I suggest expanding your question with more details to continue discussion.
Upvotes: 1