필터 지우기
필터 지우기

Genetic Algorithm - Relation between Population and Fitness Function

조회 수: 3 (최근 30일)
Sam
Sam 2014년 1월 26일
댓글: Sam 2014년 2월 21일
When using a Custom Population Function and specifically Custom Binary Population. How does the population relate to the Fitness Function?
I have both coded out but and have somewhat knowledge but lack the critical understanding of how they work together. Should my fitness function have a input variable which takes in the population and computes the fitness of the individuals?
I have not found and detailed reading material on this relation. Are there any such reading materials available on these relations or could anyone explain them please.
Thanks.

채택된 답변

Alan Weiss
Alan Weiss 2014년 1월 27일
편집: Alan Weiss 2014년 1월 27일
As described in the documentation, the creation function creates a population, and the fitness function evaluates how good each member of the population is. There is a specific syntax for the creation function, and there is a syntax for the fitness function. There is more information about fitness functions here.
For the creation function, the syntax is
function population = creationfcn(nvars,fitnessfcn,options)
GA passes the arguments nvars, fitnessfcn, and options to your creation function. What you do with those arguments is up to you. You will certainly need the nvars argument so that your population has the right number of elements, but you can use the other two arguments or ignore them as you see fit.
I hope this helps.
Alan Weiss MATLAB mathematical toolbox documentation
  댓글 수: 12
Alan Weiss
Alan Weiss 2014년 2월 21일
Sam, I suggest that you try going through the introductory documentation on how to set up an optimization in Optimization Problem Setup. The link I gave to Linear Inequality Constraints should show you how to include these constraints. Here is an extensive example in the context of linear programming.
Basically, to make a linear inequality constraint
A*x <= b
you simply pass the A matrix and b vector in the solver. For ga,
x = ga(objective,numvariables,A,b,...)
Then ga will automatically ensure that the constraints are satisfied. Please do not use any custom creation, mutation, or crossover functions, or ga might not keep the linear inequalities.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Sam
Sam 2014년 2월 21일
ohh sorry let me rephrase.. i am aware of this and have done this more than a few times now... i meant to ask how should the constraints be sent in since i need to write it in A & b format...
but after going through the documentation links for awhile now it is clearer i had confused myself by accident...
Thanks much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by