Disclaimer
First of all, this is for homework, so don't ask why it's so contrived, it is this way and it can only be this way. (I get a lot of "how about if you change something"), sorry ... I can't.
Also I must use evolutionary algorithms, that means parents have children, they can mutate / recombine, form new generations and eventually lead to a solution.
/Disclaimer
I have n*2
words of length n. I have to make a n^2
matrix containing all these words. The words can be gibberish, but they have to be able to fit in this matrix (it's a requirement on the user's part).
Thus AGE,AGO,BEG,CAB,CAD,DOG
will give me this result (1 out of at least 2 possible):
C A B
A G E
D O G
I have to use an evolutionary algorithm. Thus I need to find a way to code my information into a chromosome.
What I did come up with:
Each word has to appear, has a start position in the matrix, and an orientation (left-right or up-down). Thus I have [Word][Orientation][StartPosition]
where start position is [0][0]
/ [0][1]
/ [1][0]
etc (left column and top line). But it has restrictions, I need to validate that the orientation fits the start position.
Problems:
A chromosome has to be a possible solution whereas this is only part of a solution.
Since my solution has to be a matrix containing all the words in such a way as to "fit" the chromosome also has to somehow represent the entire matrix. But that hits several problems. I can only have one word from one starting position in one orientation (except the first two words, they share the same start position with different orientations). I can't see this working as a valid way of attempting an evolutionary algorithm. I just can't see any of the phases working, especially mutation / recombination.
Am I thinking of it entirely wrong ? If so ... why ? and how could I attempt to code my data in such a way as to let me go trough all the phases (reproduction, mutation / recombination, natural selection ... be able to calculate a fitness and start a new generation) without having tons of garbage data (having a word appear twice, lose a word, have a word on a wrong orientation compared to it's start position) ?
EDIT
I shall be using this representation to implement many other nature-inspired algorithms, thus I need a "good" data representation. Nothing makeshift that could hurt me later.
I honestly can't think of a good way though. Because I have a lot of limitation (maybe I have been thinking on this too long and I can't get past them, and they maybe aren't really there). I would really like a binary representation, but that seems impossible.