genetic algorithm - fitness function - algorithm not converging

1 回表示 (過去 30 日間)
Kallam Haranadha Reddy
Kallam Haranadha Reddy 2017 年 9 月 17 日
回答済み: Walter Roberson 2017 年 9 月 17 日
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 Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by