How can a phrase the constraint for Genetic Algorithms to generate data without duplicates?
이전 댓글 표시
Dear Matlab community,
I am trying use interpolation within the function body to evaluated by the genetic algorithm.
The genetic algorithm shall generate data of 60 variables within lower and upper bounds to be taken as x- and y-values and is therefore reshaped as follows:
datap=reshape(datap,30,2);
The first column is taken as x-values and the second column as y-values for interpolation. The x-values therefore need to be unique and in increasing order. I just cannot figure out how I can phrase the constraint for the x-values to be unique before Matlab generates them. Hope someone can help!
That's the beginning of the function:
function y=cube2shape_3(datap)
% bounds
% ub=[0,linspace(3,3,28),1,linspace(3,3,29),0]
% lb=[linspace(0,0,29),1,linspace(1,1,20),linspace(0,0,10)]
datap=reshape(datap,30,2);
sort(datap(:,1))
%fit graph to data points
ffit=fitit(datap(:,1),datap(:,2));
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!