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

5 vues (au cours des 30 derniers jours)
Shibu Samson
Shibu Samson le 11 Jan 2019
Modifié(e) : Stephan le 11 Jan 2019
How to assign the value for Integer variable indices in GA toolbox?

Réponse acceptée

Stephan
Stephan le 11 Jan 2019
Modifié(e) : Stephan le 11 Jan 2019
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

Plus de réponses (0)

Catégories

En savoir plus sur Test Model Components dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by