Update:
A entity is an object created with attributes/methods of a given entity template. A entity may have a parent and/or a number of children.
Every entity template has a thread fragmentation cost and a computer fragmentation cost. They define how costly it will be to have children of that entity on different computers/thread from the parent
New entities will be assigned to a computer and a thread at the end of every iteration (via add) and old entities may be reassigned to a computer and a thread at the end of every N iteration (via defragment).
When add is invoked, a entity is created and attached to a given parent. However, it still still has to be placed in a computer's thread's simulation runner.
The factors deciding assignment are the child {computer|thread} fragmentation costs and optionally the fragmentation cost matrix.
Original
Hi,
I'm just looking to get some ideas on a general direction/algorithm/field to solve the following problem.
I have N Entities (each with a possible parent and possible M children) in an iterative realtime simulation environment. Each entity is placed in a server environment where it is located on 1 computer and 1 thread on that computer. Each entity has a "computer fragmentation cost" and "thread fragmentation cost", which is a value from 0->1 (with 1 being the most expensive) that defines how painful/costly it will be to have that entity's children on different computers or threads. "computer fragmentation cost" will be higher than "thread fragmentation cost".
I have 2 operation. A "add" operation that's executed when a entity is initially added. I also have a "defragment" operation that runs at the end of every Y iterations that relocates entities to different threads/computers.
What is a general algorithm/guideline that makes sure the fragmentation stays at a minimum for those 2 operations, given the fragmentation costs?
Also, each entity is created from a predefined template. There will be a matrix defining the fragmentation costs between every pair of entity template. How can this additional data be used to lower fragmentation?
Thanks