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.

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 17일
datastruct = load('DPDPSCM.mat');
C = datastruct.C;
fun = @(x) sum(C.*x);
bestx = ga(fun, 150);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by