how to use bit string in fitness ga(tool) genetic algorithm matlab

1 次查看(过去 30 天)
i have problem in my program routing(ga tool) when i find the result i want the ga tool to stop but it still running until the generation equal 0 ; i use the bit string type so i want way to put condition in my project to stop the running when find the first solution for example (ans = 100)
--------- my code---------
function g =myfitness2(X)
LAMDA=X(1)+X(2)*2+X(3)*4+X(4)*8+X(5)*16
TYPE=1;
ITER=1000;
R1=Routing3a(TYPE,LAMDA,ITER);
g=-R1
end
........
result of program it
LAMDA 3
g=33.25
LAMDA 17
g=-100
LAMDA 11
g=-100

回答(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