How to assign the value for Integer variable indices in GA toolbox?

조회 수: 1 (최근 30일)
Shibu Samson
Shibu Samson 2019년 1월 11일
편집: Stephan 2019년 1월 11일
How to assign the value for Integer variable indices in GA toolbox?

채택된 답변

Stephan
Stephan 2019년 1월 11일
편집: Stephan 2019년 1월 11일
Hi,
consider you have 8 variables x(1)...x(8). The following code makes x(1), x(2), x(4) and x(6) integer constrained in range from 0 to 1:
fun = @(x)...
nvars = 8;
A = [];
b = [];
lb = [0 0 3.5 0 3.5 0 2.75 4.2];
ub = [1 1 15 1 23 1 42 666.666];
nonlincon = @(x)...
Intcon = [1, 2, 4, 6];
res = ga(fun, nvars, A, b, [], [], lb, ub, nonlincon, Intcon)
Best regards
Stephan

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Test Model Components에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by