optimization using genetic algorithm

1 次查看(过去 30 天)
function z=min_fucn(t) z=5500*600*12+34.38*t(37)+45.83*t(61)+162*t(1)*23+30.38*t(49)+40.50*t(73)+1200*t(13)+300*t(121)+200*t(133)+34.38*t(38)+45.83*t(73)+1200*t(13)+300*t(121)+200*t(133)+34.38*t(38)+45.83*t(62)+162*t(2)*22+30.38*t(50)+40.50*t(74)+1200*t(14)+300*t(122)+200*t(134)+34.38*t(39)+45.83*t(63)+162*t(3)*25+30.38*t(51)+40.50*t(75)+1200*t(15)+300*t(123)+200*t(135)+34.38*t(40)+45.83*t(64)+162*t(4)*20+30.38*t(52)+40.5.*t(76)+1200*t(16)+300*t(124)+200*t(136)+34.38*t(41)+45.83*t(65)+162*t(5)*21+30.38*t(53)+40.50*t(77)+1200*t(17)+300*t(125)+200*t(137)+34.38*t(42)+45.83*t(66)+162*t(6)*24+30.38*t(54)+40.50*t(78)+1200*t(18)+300*t(126)+200*t(138)+34.38*t(43)+45.83*t(67)+162*t(7)*17+30.38*t(55)+40.50*t(79)+1200*t(19)+300*t(127)+200*t(139)+34.38*t(44)+45.83*t(68)+162*t(8)*16+30.38*t(56)+40.50*t(80)+1200*t(20)+300*t(128)+200*t(140)+34.38*t(45)+45.83*t(69)+162*t(9)*18+30.38*t(57)+40.5.*t(81)+1200*t(21)+300*t(129)+200*t(141)+34.38*t(46)+45.83*t(70)+162*t(10)*21+30.38*t(58)+40.50*t(82)+1200*t(22)+300*t(130)+200*t(142)+34.38*t(47)+45.83*t(71)+162*t(11)*22+30.38*t(59)+40.50*t(83)+1200*t(23)+300*t(131)+200*t(143)+34.38*t(48)+45.83*t(72)+162*t(12)*17+30.38*t(60)+40.50*t(84)+1200*t(24)+300*t(132)+200*t(144);
the above equation is my objective function.
in this problem , i have both linear equality and inequality and nonlinear constraint. and the decision variables are non-negative and integer. but in GA toolbox, when there are integer constraint, GA does not accept linear or nonlinear equality constraint. it accepts only inequality constraint.
how can i solve this problem in GA toolbox.
  1 个评论
Walter Roberson
Walter Roberson 2013-4-1
Please read the guide to tags and retag this question. http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
You do realize that your function is completely unreadable? Have you considered adding some whitespace? The same constants appear to be repeated a number of times: have you considered giving names to those constants and using them in the formula? Have you considered documenting justification for why the 45.83 should not be (for example) 45.82794 ?

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2013-4-1
(A == B) can be expressed as ((A <= B) & (-A <= -B))

Matt J
Matt J 2013-6-20
编辑:Matt J 2013-6-20
but in GA toolbox, when there are integer constraint, GA does not accept linear or nonlinear equality constraint. it accepts only inequality constraint.
The equality constraints would have to have a very particular structure to be satisfied by integer-valued variables within TolCon precision. You would have to be sure in advance that the manifold the constraints define contains an integer-valued point exactly. That probably means that the coefficients of the equalities would have to be integers as well, e.g., like this
x+y+z=10
In cases like this, you should probably eliminate some variables so that the constraints are not needed. In this example, that could be done by replacing z in the fitness function by
z=10-x-y

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by