How to set the variables as integers in a Genetic Algorithm Function?

65 views (last 30 days)
Supposing the objective function is @(x)f(x(1),x(2)). I would like to set the variable 'x' as a integer in a Genetic Algorithm Function.
How should I do? Is there anyone knowing it?
Thanks, Zheng

Accepted Answer

Walter Roberson
Walter Roberson on 7 Jul 2012
Edited: Walter Roberson on 27 Feb 2015
Note that there are a number of restrictions on ga()'s operation when you constrain to integer.
Walter Roberson
Walter Roberson on 22 Mar 2017
Is the general form
x = ga(fitnessfcn,nvars,A,b,[],[],LB,UB,nonlcon,IntCon)
not what you need?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by