How to operate genetic algorithm optimization for output values in given range?

Hello!
I've got a problem when I want to optimize a fitted function with three variables. The output after the first iteration is already in a non-feasible range. A realistic output for my problem would be anywere above 0.5 but after the first iteration step it already gives me somewhat -4e14.
I now don't really now how to fix this problem as the FitnessLimit I set at 0.5 will never be able to work. How do I fix such a problem? I thought of adding an option which allows to operate the optimization in much smaller steps of output values to be able to reach the limit...
Thanks in advance!
opts = optimoptions('ga', 'PlotFcn',{@gaplotbestf,@gaplotstopping}, 'FitnessLimit', 0.5)
[k,fval, exitflag, output] = ga(fh,3,[],[],[],[],[LB(1) LB(2) LB(3)], [UB(1) UB(2) UB(3)],[], opts)

1 件のコメント

Matt J
Matt J 2018 年 8 月 30 日
編集済み: Matt J 2018 年 8 月 30 日
Which "output" is violating desired bounds, k or fval? If it's fval, why shouldn't a FitnessLimit of 0.5 work?

サインインしてコメントする。

 採用された回答

Alan Weiss
Alan Weiss 2018 年 8 月 30 日

1 投票

I have two different but related comments:
1. If you have a feasibility constraint such as certain outputs have to be in a certain range, then include those constraints as nonlinear inequalities.
2. I think that you would have better luck if you would change your solver from ga to either fmincon (supposing that you have a smooth objective function) or pattersearch (supposing that your objective function is not smooth). See Table for Choosing a Solver.
Alan Weiss
MATLAB mathematical toolbox documentation

1 件のコメント

Luki Höb
Luki Höb 2018 年 8 月 31 日
Thank you very much!
I tried fmincon and patternsearch and got the same results. Then I ploted my fitness function and realised that the function itself is wrong, I set one parameter wrong in polyfitn.
It wasn't the solution for my problem but helped me to solve it, thank you! From now on I'll plot every function to check it...

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2018 年 8 月 30 日

コメント済み:

2018 年 8 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by