- pass in an CreationFcn that uses only the permitted values
- supply your own CrossoverFcn and MutationFcn, which "just happen" to satisfy your requirement each time
How to control the step length or accuracy of decision variables X in gamultiobj? I need the X just be assigned as 0.001, 0.002 or 0.02, instead of 0.001234.
1 view (last 30 days)
Show older comments
I use the funtion gamultiobj. I need the decision variables X just be assigned as 0.001, 0.002 or 0.02, instead of 0.001234. Is there a method to control the step length or accuracy of decision variables X in the multiobjective optimization?
[X,Fval,exitFlag,Output]=gamultiobj(FitnessFunction,numberOfVariables,A,b,Aeq,beq,lb,ub,options);
0 Comments
Answers (1)
Walter Roberson
on 10 Jun 2018
gamultiobj is not designed for discrete variables.
What you have to do is use the options structure:
3 Comments
Sonja Kallio
on 27 Jan 2021
Could you give us an example how to write CreationFcn with prmitted values?
I have CreationFcn which uses a for loop to create the Initial Population.
There is 3 decision variables which are varied by the for loop.
Should I define the permitted values somehow in the function, for example like this:
x(1) = (1:1:10)
Best regards,
Sonja Kallio
Walter Roberson
on 28 Jan 2021
Assuming for a moment that you are using integer variables and that lb and ub have been set appropriately,
for iter = 1 : population size
for var = 1 : nvars
x(var) = randi([lb(var), ub(var)]);
end
population(iter,:) = x;
end
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!