How to optimize a non linear single objective function constrained with only integer variables using genetic algorithm?

15 ビュー (過去 30 日間)
For my problem which is a single objective, I am using genetic algorithm. In my problem, I have five different variables (all integer values) and their values are listed below.
Variable 1= 1500, 2000, 2500, 3000 and 3500.
Variable 2= 50, 55, 60, 65,.....100.
Variable 3= 5, 6, 7,...15.
Variable 4= 5, 6, 7,...15.
Variable 5 = 5, 6, 7,...15.
I want to use binary GA (not real GA), but I am facing an issue in their representation using binary bits due to the precision factor.

採用された回答

Alan Weiss
Alan Weiss 2017 年 2 月 27 日
編集済み: Alan Weiss 2017 年 2 月 27 日
You would probably do best to use the ga mixed integer optimization capability. Have your five variables be integer-valued. Internally, in the objective function, change the variables to their appropriate values, something like this:
function y = objfun(x)
v1 = 1500 + 500*x(1);
v2 = 50 + 5*x(2);
v3 = 5 + x(3);
v4 = 5 + x(4);
v5 = 5 + x(5);
% do your fitness calculation using the v variables
% here
end
Call the ga solver with IntCon = 1:5. Set lower bounds of zeros(5,1) so each variable is 0 or greater, and upper bounds of [4,10,10,10,10]. There is a similar example here.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 件のコメント
Ripunjoy Gogoi
Ripunjoy Gogoi 2017 年 2 月 27 日
Thank you Sir. But there is an issue. I am not allowed by Matlab GA to use single point crossover (which I want to use in my problem). By default matlab is using scattered crossover when I use IntCon. Any suggestion please?
Alan Weiss
Alan Weiss 2017 年 2 月 28 日
If you really cannot use the built-in mixed-integer solver, then you must write your own custom creation, mutation, and crossover functions, and ensure that these functions return only integer values and also respect your bounds and any other constraints that you might have. This is not a task for a beginner, but it can be done. For details, see this link for custom creation functions, this link for custom crossover functions, and this link for custom mutation functions.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

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

その他の回答 (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