Variable in cost function should take only two values.

1 次查看(过去 30 天)
How can i set my objective function variable to take only 0 and 1 and not anything in between? I am using ga solver and my objective function is like min(f(x))= x(1) + x(2) + x(3) with constraint that (x(1) +x(2) + x(3))*0.2=0.4. Please help
  6 个评论
John BG
John BG 2018-4-30
编辑:John BG 2018-4-30
working in binary formay may come handy:
L=dec2bin(randi([0 100],1,1))
uint8(str2num(L(:))')
John BG

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver-Based Optimization Problem Setup 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by