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!