03-21-2006 04:41 AM
03-21-2006 02:03 PM
03-22-2006 03:02 AM
Hi,
I have a problem opening the file you sent back. I am using v.7.1 and I assume you must have used v.8 as that is an error that comes up. Genetic algorithms are great little programs, but I can explain a little more about what I am trying to do. Firstly on the left of the VI, a user defined number of samples is specified, and a user defined length of array. The "createinitialarray.vi" creates N samples of length M arrays filed with random values that has a floating point representation (i.e. if I want my values in the array to lir between 0-5, the numbers are any random number (doesn't have to be an integer) between 0 and 5).
After the arrays are created (ultimately I need approx. 30 arrays of 640 values) they are assigned a fitness function. The fitness function I have in the VI at present will not be what I use experimentally. The feedback into the fitness function will come from a mass spectrometer assigning a particular current associated with each array. I don't yet have that equipment or the drivers so I can't create that part yet, so I keep a simple fitness function for now. Each array will eventually be linked to a liquid crystal spatial light modulator (LC-SLM) that has 640 pixels, hence the 640 points in the array. Each pixel will have it's phase varied between user defined values (that is why I needed the floating point representation). I am trying to optically shape femtosecond laser pulses. Again, I can't add the link to the LC-SLM as it hasn't arrived yet and all I know is that it is LabVIEW compatible. After each generation (the calculation of the fitness of each of the 30 arrays) the fitness is plotted to a chart and the 30 (intially random) arrays go through a selection process. The arrays with the highest (or lowest depending on what I want) fitness functions undergo crossover and mutation (Darwinian evolution operators) in the "RouletteWheelSelectionSmallArray", and an improved population of another 30 arrays is created.
This process will continue until the fitness function reaches a required accuracy specified by me, at which the GA will have done it's job and I will have the laser pulse that I require.
I hope this makes your understanding of my project a little clearer. I can use LabVIEW OK but I haven't used it for 18 months and I am very rusty. I am most grateful for any help. Is there a way of opening an application produced in LabVIEW 8 in LabVIEW 7.1?
Thanks
ALan Homer
03-22-2006 06:41 AM
Hi Alan,
You cannot open an application SAVED in LabVIEW 8 within LabVIEW 7.1.
However, you can save an application produced in LV 8 as previous version ie produce it in LV 8 and save it as LV7.1. This will allow LV 7.1 users to open the application although it was produced in LV 8
This is done by using "file"> "save for previous version" rather than using "save as".
I have opened the annotated LV 8 VI that was posted and saved it back to LV 7.1 for you, so you should be able to open it now.
Hope this helps you,
Emma R
NIUK & Ireland
03-22-2006 06:46 AM
03-22-2006 07:35 AM
Kenny K,
I have attached the original version of the simple GA that works and originally created a Boolean array. That is the reason why I changed the "Create Initial array" subVI. I need to be able to specify the number of arrays, the number of genes(values) in each array, and I need the values in the array to be a floating point representation. The "N random arrays" VI works exactly as I want it to, but I need to incorporate that VI into this version that I have attached instead of the "CreateInitialArray.vi".
Also, the feedback loop shown in this attached version is definately required. That is the whole idea of the GA to operate in a feedback loop system so the fitness function is continually improved.
Thanks for the help.
03-22-2006 09:58 AM
If i read it right, you want to replace the Create Initial Array (outputs boolean into theinitalze terminal) with the NRandomArray (which outputs double into the initalize terminal). Did I get it right??
I altered your VI to use dbl's throughout instead of the booleans. I attached it below. You will need to go though and make sure it is outputting erverything you need. You will probably need to change some of the algorithms, but let me know if it helps.
Kenny
03-30-2006 03:25 AM - edited 03-30-2006 03:25 AM
Thanks for the help mate but I think there still maybe some misunderstanding as to what I am trying to achieve. I have worked through the GA and for a while I thought it was working but after a closer look I realized it is not achieving its aims. I have worked through the GA from start to finish and mentioned what I expect to see at each point.
1) On the front panel, the user inputs a vlaue for the "Number of Samples" and "Length" which correspond to the number of arrays wanted and the length of these arrays. For a simple case scenario I tried to run Number of Samples = 5, and Length =2.
2) These values then pass into the "N Random Arrays VI" and 5 arrays of length of 2 should be created and filled with floating point numbers randomly selected between 0 and 1. i.e. an example of the expected output here would be [0.12, 0.45], [0.98, 0.65], [0.45, 0.32], [0.76, 0.74], and [0.01, 0.67]. (These have just been made up by me to show what I want to be produced).
3) These N arrays should then pass into the "Calculate Fitness.vi" which is presently set to calculate "4 x Total sum of array elements" in each array, therefore all 5 arrays would be assigned a fitness value (i.e.for my example arrays above the respective fitness values would be 2.28, 6.52, 3.08, 6 and 2.72.
4) Ignoring the statistics route for now, each of these 5 arrays should pass into the "RouletteWheelSelectionSmallArray.vi" where these "parent" arrays are paired up and undergo a crossover procedure dependant on their fitness values. The higher the fitness value the more likely they are to be involved in the crossover procedure. They then undergo a 0.1% chance of a random mutation at a random point on an array. At this point at the end of this subVI there should still be a population of 5 arrays consisting of 2 floating point values, but which are different to the initial population.
5) There is then a feedback loop that returns these 5 new arrays to the "Calculate Fitness VI" and the process repeats until the average fitness is optimized.
In testing the GA I placed a write to spreadsheet subVI at the enf of (4) so in theory I should be prompted in each generation (one single loop) for 5 file names in which in each should be placed an array of 2 floating point values between 0 and 1. Instead I get the results:
Generation 0 (the first loop using the 5 initial arrays in theory): one file that contains the values 0.536 and 0.462 (exactly what I want but I want 5 of these in each generation not just one) and I was prompted for a second filename in generation 0 and inside it returned the values (4,3,4,4,3) that look to be like the sample numbers 5 times? (not what is required).
In generation2 I was prompted for another filename that returned the value 72, and another filename that returned the value 288 (72 x 4). By this point I think the VI is just looping an individual fitness value and multiplying it by 4 instead of assigned 5 arrays of 2 values a fitness function each. Then in following generations the same proces occurs, i.e. the gen 4 values were 1152 (288 x 4) and 4608 (1152 x 4).
Can anyone help put this procedure correct so that the VI does what it should? I have tried following the process through step by step and I can't see why it's not working.
Thanks
I was prompted for nothing
Message Edited by alanhomer on 03-30-2006 03:25 AM
03-30-2006 11:19 AM
04-04-2006 08:53 AM
FAO KennyK:
Hi, I managed to solve the problem of the VI so now it works (almost) as I would like. I thought I would post the vi so you could have a look as you seemed quite interested in the work.
Thanks for the help.