I’m trying to develop a genetic algorithm that will find the most efficient way to connect a given number of nodes at specified locations.
All the nodes on the network must be able to connect to the server node and there must be no cycles within the network. It’s basically a tree.
I have a function that can measure the “fitness” of any given network layout.
What’s stopping me is that I can’t think of a crossover function that would take 2 network structures (parents) and somehow mix them to create offspring that would meet the above conditions.
Any ideas?
Clarification: The nodes each have a fixed x,y coordiante position. Only the routes between them can be altered.
Let me begin by answering your question with a question :
How does the fitness function behave if you create a network layout that violates the ‘no cycle’ rule and the ‘connect to server’ rule?
If it simply punishes the given network layout via a poor fitness score, you don’t need to do anything special except take two network layouts and cross them over, 1/2 from layout A, 1/2 from layout B. That’s a very basic cross over function, and it should work.
If however, you are responsible for constructing a valid layout and cannot rely on invalid layouts simply being weeded out, you’ll need to do more work.