How to force the GA optimization for certain varibale values ??

2 views (last 30 days)
Hello every one, I am using GAtool to optimize a function. I wrote the function in matlab m-file
suppose that I have this function y(x)= 2x^2+sinx,
I want to use the gatool to solve for optimum value of x easly.
my question is that. what if I want the value of x used in optimization goes in certain range
like x= [ 0.2 0.4 0.6 ..........100] ,
how to tell the gatool box that x do optimization but for these x values only
so it is not allowed to get answer x=0.22 for example
many thanks

Answers (1)

Alan Weiss
Alan Weiss on 20 Jan 2015
Turn your problem into one of Mixed Integer Optimization. There is an example here that shows how to convert from integer to general discrete constraints, but your case seems simple (x to x/5 for x between 0 and 500)).
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!