Add your own alternative version
Stats
144.8K views 28 bookmarked
Posted
17 May 2005

Comments and Discussions



good morning loay ,
have you an example of genetic algorithm with real coding?





what does the sign bit represent ? plzzzz answer me





Sign bit is a bit that identifies the number to be negative (if Sbit =1) or positive (if Sbit = 0)
Luay Alwesi





Hello luay,
I am a student in the university third year, and i'am writing a code in java to make a program that optimizes numeric functions using the genetic algorithm( the same as the one you mentioned).
though, i'am having some issues with it, i think it blocks to a local optima so please if have some time to take a look at it and tell me what to change!
Zakaria J






Hello!
Can you give me a hand?
Recently, I need a source program about using the genetic algorithm to geneate a maze on VC++.But I don't know how to program it,can you help me to program it?
Sincerely





I find this article very informative





i need genetic algorithm based adaptive filter design in matlabcode





Hi
I want to ask :
1. why during compiling the function "mutation" does not work in the code?
2. When I change the y function into y= ( x^ 2 ) 1 the value become zero ?
thx alot





Q1. Why there are 6 bits taken in the struct chromes?
And
Q2. Why in mutation procedure, have condition random == 25?
And
Q3. I have a problem to find max of the function f(x)=1/((1+x^2)0.001), by implementing in above program i always got fittness value = 0.0. So there is any problem in program?
Amit Kumar Mishra
E.Mail: amit.ku.mishra@gmail.com





Hello Amit,
A1: You can use as many bits as you need ... it depends on the complexity of your function, but for this example, 6 bits were enough, since it will provide range of 31 to +31
A2, The main reason behind choosing random == 25, is to have low priority for mutation, since this is choosing one number out of 50 numbers, so it's 2% probability ... you can set this to be any number.
A3, Keep in mind that this program was structured to deal with the integer number range (31 to +31), your function would generate a lot of fractions, you would need to reconfigure the functions and variables to have the bits structured into integers and fractions to get accurate numbers, in your case you would need much more bits than just 5.
Loay Al Lusi





sir,
i have few numbers which are to given as input to GA and the numbers are not in binary form and the output is also not binary. what method can be used for this? can GA be used for this. and how do calculate the fitness function
kindly reply
regsrda pallavi





Hello Pallavi,
Yes ... you can use GA for that ... all you need to do is to use a converter that would convert this number to binary ... then convert the binary output back to number ...
The fitness function is chosen depending on the needed output ... what are you looking for in this problem? what do you want to achieve? highest value in a function? lowest value? ...etc
Depending on that ... you should set the fitness function to be
Hope that helps
Luay Alwesi





Hello Luay, hope you have a nice day.
My name is Joanne and currently I am writing myself a genetic algorithm. One part of my program doesn't work and I couldn't find where is my mistake.... I wonder if you are kind enough to help me to find out my error?
Thank you so much, hope to hear from you





Hello Joanne,
Thanks for contacting me regarding this
What language are you using to write the code?
I didn't work with programming for the past 3 years, and I don't even remember the softwares used to compile them ... anyway, if you send me a copy of your code, I'll take a look at it .. and maybe I will figure out the problem
Hope you good luck with your work/study
Luay Alwesi





how travelling salesman problem implementation using genetic algorithm in c/c++.





Dear Sir,
I thank you very much for the code of GA. However I need your help as follows.
01. Number of rows (chrome) is 'r' (i.e Population size 'r')which you have considered 4.(I need to have 1,2,3,.....r);
02. Number of column (gens) is 'c'. Which you have considered of 6.( I need to have 1,2,3.........c)
03. It has been mentioned mutation is in between 0 and 1. It is o is replaces 1 and vice virsa. However I want to have 1,2,3.....c. i.e. in numbers which will replaces.
04. Selection of fitness is based on roulete wheel approach.
If I could get modified code it will be greate help to me. Kindly forward the same to my email ID.
bv_raaghu@yahoo.co.in





Hello Luay
I am a new learner in C programming and is very interested in your genetic algorithm program. I tried to copy and paste your codes to my Microsoft Visual C++ 6.0 and found 14 errors when I try to compile it.
I would like to know what is Chrom? Is it an expression or a just a word representation?





Hello Joan,
Thanks for your interest in this article.
Actually this is an Algorithm that was implemented from the actual human chrome/genetic system.
The chrom here is a set of bits that will count up to a certain value (fit) ... which is used as the X values for the Y(x) functions .. and will end up giving us the best value we want.
This code was written using Turbo C ... so it should work on C .. not C++.
Good luck
Luay Alwesi





Thank you for your reply
Another question I have here, from int x(chrom popcurrent),
z=(popcurrent.bit[0]*1)+(popcurrent.bit[1]*2)...+(popcurrent.bit[4]*16);
if(popcurrent.bit[5]==1)
z=z*(1);
Now from your initial table given:
c no. 1
Sb 0
b5 1
b4 0
b3 1
b2 1
b1 0
fit 8
My question is, how do you calculate the value of z for c no. 1 and by using the formula fit=(x^2)+5, how did you get the value fit=8?
Thank you for your patient and your precious time





Dear,
In the first tables, the function wasn't actually applied on the chrom values, these were only trivial examples for explanation of the idea, sorry for the confusion.
But if you want to apply it, it would be as follows:
Chrom No.  Sb  b5  b4  b3 b2  b1
1 0 1 0 1 1 0 => x= +22
Fitness = y(22) = (22^2)+5= 479
I hope this helps
Luay Alwesi





Yes, I get your idea. Thank you so much





You are welcome
Luay Alwesi





Luay, Thank you so much, your programmed helped me a lot. However, do you have any GA C code with integer representation instead of binary representation?





Hello,
I am pursuning master's .
i am working on GA for my desertation work, i want to select best group of 3 from 50 members(or more)on the basis of their skill(i.e. therir age, sex , experience ,awards etc)
hw can i implement this in matlab..
or what is better to implement it
Plz help me .......... i am in trouble...........plzzzz
my email
vibhor.sharma2000@gamil.com





Hello Vibhor,
According to your problem, the most important this is how to specify the fitness function...
So you have to work on that ... what is the weight of each element of this group, the Age, sex, experience awards ... etc ...
Most probably it won't be a linear relationship ... since people having ages between 20 and 30 would be the best in their field when it comes to age, while older people have the benefit of the experience...
So you should do it in a way that will fulfill real life scenario of who is actually the most fit among them ...
There are some Genetic Algorithm applications in MatLab ... it could be more complicated to deal with it .. but it works...
Hope you good luck in your Master project
Luay Alwesi





hello, i'm trying to implement multicast routing algorithm to find the optimum path to multicas destinations. Can u pls suggest a good fitness function?
thanku





Thanks a lot
I have an other question:
I am working on a project with subject of”Weekly timetabling of a university “ and I am making use of Genetic algorithm of Matlab.The time table is going to have the least time gap for the professors and the students and also it should have the least time interface.
I am really confused adjusting the fitness function of it. would U please help me?
Even a small tip is really helpful to me .
Thank you very much in advance.





Ok .. could you please describe the function and the problem you have ?
I don´t fully understand what you mean by the timetable problem here ...
Luay Alwesi





Thanks a lot
I have an other question:
I am working on a project with subject of”Weekly timetabling of a university “ and I am making use of Genetic algorithm of Matlab.The time table is going to have the least time gap for the professors and the students and also it should have the least time interface.
I am really confused adjusting the fitness function of it.Is there anyone who can help me?
Even a small tip is really helpful to me .
Thank you very much in advance.





At the moment I am working on a project called “Weekly programming of a university “ making use of Genetic Algorithm in Matlab .
Would you please help me in finding an appropriate source (such as ebook, website ,...)in this field?
regards
Parisa Gharavi





I believe there is a built in plugin for that in MATLAB ...
check below :
http://www.mathworks.com/products/gads/
Regards
Luay Alwesi





It s really good example for new programmers. Thanks for codes.
Mustafa Öner Dikdere
Say NO! to the Armenian pinocchio...





Perhaps, new starter should look into more examples and scenario for GA to solve problem.
Take a look at: www.geneticalgorithm.ahyeek.com
This site contain solution for GA in solving vehicle routing problem and multi variants optimization
problem. It's a very good examples to look into.
Hope this help.
Ahyeek
http://silyeektech.blogspot.com
Since 1998 ...
modified on Tuesday, March 10, 2009 10:41 PM





i have a microvawe problem that i have to solve with genetic algorithm teqniques the problem is like
50=xj+(1/(50/yj+50))
i have done integer problem before that was easy but i have complex programming now something confuse my mind . i just want to adapt this problem to my program . could you help me ???
thank you..





fiore45 wrote: i have a microvawe problem that i have to solve with genetic algorithm teqniques the problem is like
50=xj+(1/(50/yj+50))
i have done integer problem before that was easy but i have complex programming now something confuse my mind . i just want to adapt this problem to my program . could you help me ???
thank you..
Hello there,
sorry for taking so long to reply, I was busy a little ..
About the function you mentioned ... the GA is a way to randomize numbers in order to get the max or min output value for a given function ... so whatever the function is .. you can use the GA, but the more complex it is .. the more iterations you need ...
About the integer issue , it's an easy case .. instead of using binary numbers for integer values only, you can add some binary digits to present the fracture part of the integer ...
For example, instead of using 0001 to present the number 1, you can use 0001.0000 to present the same number .. but this way, we get 4 more digits to present the fracture ... so :
0001.1000 would equal 1.5
0001.1100 would equal 1.75
0001.1110 would equal 1.875
0001.1111 would equal 1.9375
0010.0000 would equal 2.0
0100.0100 would equal 4.25
and so on ... where the part on the left of the dot will be the integer presentations, while the part on the right will be the fraction presentations ... the more bits you add for the fraction, the higher accuracy you will get ...
The fraction part will be read as follows :
0.1000 = 1/2
0.0100 = 1/4
0.0010 = 1/8
0.0001 = 1/16
and so on ...
I hope this helps you out ...
Luay Alwesi





hi
i want the code for hybrid algorithm: Estimation of Distribution algorithm and Genetic Algorithm





Hi everyone, sorry for not providing much description ... I will try to update the article and give more detailed version later this week with god willing ... until now please check the source code ... it has some comments to help you out.
Luay Alwesi





in other words....put down that beer, tell your boyfriend to top nibbling on your ears....and pay attention to what you are writting...the subject is good, but the author is in lala land
GOOZOO KHAN





could you take another look now GOOZOO.. ?
Luay Alwesi





It's a VERY good subject, you just trown your paper in minutes to put your nick somewhere in a valuable place. I would like to read about what you have to teach me on this line I sustain my vote until then...
Read the following articles on the subject :
http://www.codeproject.com/cpp/tspapp.asp
http://www.codeproject.com/cpp/GeneticandAntAlgorithms.asp
Kochise
In Code we trust !





Hi Kochise .. please take another look now .. I have updated it
Luay Alwesi








General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

