genetic algorithm - fitness function - algorithm not converging
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to apply genetic algorithm for a 150 variable linear programming problem.
I wrote the fitness function 'fit1.m' as follows.
The Cost coefficients of the objective function are saved in DPDPSCM.mat file.
function [ obj ] = fit1( C,X )
load DPDPSCM.mat
C;
X = randi([1,10],1,150)
y = C.*X;
obj = sum(y);
end
The genetic algorithm is not converging.
where did i made the mistake.
댓글 수: 0
채택된 답변
Walter Roberson
2017년 9월 17일
datastruct = load('DPDPSCM.mat');
C = datastruct.C;
fun = @(x) sum(C.*x);
bestx = ga(fun, 150);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!