genetic algorithm - fitness function - algorithm not converging
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Siva
 el 17 de Sept. de 2017
  
    
    
    
    
    Respondida: Walter Roberson
      
      
 el 17 de Sept. de 2017
            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 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 17 de Sept. de 2017
        datastruct = load('DPDPSCM.mat');
C = datastruct.C;
fun = @(x) sum(C.*x);
bestx = ga(fun, 150);
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Genetic Algorithm en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

