0

I have a rectangular node with 3 attractors and i have two kind of product;the first(product A) twice than the other (product B) in width. I want to create a logic by which when i put the product A in the attractor1,i cant'use the attractor2 next to it but i have to use the attracttor3 for the product B or no one for the product A. Does exist a way to use a attractor variable that change dynamically or any other solution for this problem?(i used 3 attractors but I'm working with hundred e i don't want to write an if for all of them). Thanks a lot for the help.

2 Answers2

0

what i like to do is

  1. create a class that has the attractor and its characteristics
  2. have a linkedhashmap with the node as the key and an arraylist of the attractors class previously created as the value.

using agents instead of a class is fine too...

Felipe
  • 8,311
  • 2
  • 15
  • 31
  • Absolutely. Agents are typically less "hardcore" for beginners and actually offers more flexibility. Downside is reduced performance for massive models. – Benjamin Jul 08 '21 at 18:34
-1

Best create agents that represent attractors. Instead of using attractors, you send your products to these agents, each with a specific x/y coordinate (if you want).

Then, each product can compute itself "do I have space at agent X" and "is agent X even free?"

But the overall coding you do need to do yourself, unless you switch to the material-handling library where your Product dimensions would be accounted for via collision avoidance (but it typically runs slower due to that)

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • Sorry,but the problem is not the same?i know if an agent is free or not,but how do i say to the program that the agent next to it is not free even without the product stocked? – Luigi Aurilio Jul 08 '21 at 20:51
  • sorry, not sure what your question is. Sounds like a different question that you should open a new issue for. – Benjamin Jul 09 '21 at 09:30