I created a simple genetic algorithm code using the MATLAB genetic algorithm application optimtool.

Main:

    function [x, fval, exitFlag, Output, population, SCORE] = main()

    nVar = 1; FF = @opt;

    k = 1;

    opts = gaoptimset;

    opts = gaoptimset(opts,'InitialPopulation',k,'PopulationSize',1);

    [x, fval, exitFlag, Output, population, SCORE] = ga(FF,nVar,opts);

Objective function:

    function [y] = opt(t)

    y = abs( t - 1 );  

It seems that there is a trouble when I call a software to find the objective function variable `t` instead of directly make t assigned to the value `k` of individual of the population.

Is there anybody who knows something about that or who managed to call a simulation software using ga application of genetic algorithms?    

More Panagiotis Dimakopoulos's questions See All
Similar questions and discussions