09-18-2019 09:51 AM
Scenarios - I select a number between 1 and 100. I want to make a genetic algorithm that prompts the user for an initial guess, max step size (s), and population size (n).
Actions - Mutate the generations to guess the correct number. This number of "mutations" or iterations is not limited yet but could be.
Ideally, I would like to plot each round and do this at a time of 1 second per generation. Attached is my vi. I am a new user.
Solved! Go to Solution.
09-18-2019 10:49 AM
As a first step, do a few LabVIEW tutorials.
In general, of you have question about a certain algorithm, please add a link to a website that describes it.
09-18-2019 11:03 AM
Thanks for the feedback altenbach. Instead of saying what is wrong with the vi, could you suggest solutions?
The goal is this:
09-18-2019 11:03 AM
Man there are a lot of Rube Goldberg's in your code.
I went ahead and cleaned them up with the equivalent but simpler code. See attached. (Test it to make sure I didn't miswire something that causes a different result.)
As for your question, I have no idea what you mean by a "genetic algorithm" or understand your description of the process. Hopefully cleaner code makes it easier for you and others to sort that out.
09-18-2019 11:09 AM - edited 09-18-2019 11:28 AM
@JohnKellyPhD wrote:
Thanks for the feedback altenbach. Instead of saying what is wrong with the vi, could you suggest solutions?
I pointed out general flaws. I cannot suggest improvements until I know what the code is supposed to do. You have not even said where the 1...100 is entered and what typical values for all controls are. I'll have a look at your link later.
09-18-2019 12:31 PM
Thanks for the clean up! But it looks like the task is different. I did a horrible job of explaining...
The process should be:
1) Set "Target"value (ex: 50)
2) Set "Initial" value (ex: 10)
3) Set "Range" (ex: 5)
4) The program should generate n number of random values. n = Population size.
5) These numbers should be compared to the Target. The closest number to that Target should be sent back as the initial value so that new random numbers can be generated from that.
Note: If the initial value is 10 and the range is 5, the best case output is 15 (if the target is 50). The next iteration. 15 is the starting point and now 20 is the best possible output. Eventually the output gets close to 50 and then statistics of the random number generator will drive the number of iterations.
Does this make sense?
09-18-2019 01:29 PM
Maybe something like the attached can give you some ideas.