How to limit optimisation program to choose only integer variables within defined range?

6 vues (au cours des 30 derniers jours)
Hi
Anyone can help about this please?
How can I (&whether it is possible to) limit optimisation tool to choose only integer variables?
I have function mincost = test(Y) and
I use ga optimization tool for @test fitness function with 6 variables (also Integer variable indices:6)
Lower bound of Y: [1,1,1,1,1,1]
Upper bound of Y: [2,6,6,4,4,4]
At this moment, the program randomly chose Y(i), i = 1-6 like
1.1332993819797816
4.660656524721953
5.2309318902929665
3.3115450806295033
1.7702517943428866
3.0
(I have no idea why only Y(6) is integer.)
Then, I assigned
X = int16(Y) in my script so from above
X = 1 5 5 3 2 3.
(X is used as index to a cell in matrix in order to get values for calculation the mincost function.)
Which part of the ga optimization tool should I set it and how if I want to shorthen the time of optimization running by limiting X as integers in the lower& upper range?
I think if MATLAB can choose only integer, the result will be delivered faster& run in most/all limited possibiilties which may help to find the case with the minimum value among 4,608 possibilities (2*6*6*4*4*4).
Moreover, is ga suitable for my problem or should I use any others? or any codes?

Réponse acceptée

Alan Weiss
Alan Weiss le 13 Nov 2018
If your objective function test is linear, then you should use intlinprog to solve your problem.
Otherwise, use ga according to the instructions in Mixed Integer Optimization.
Alan Weiss
MATLAB mathematical toolbox documentation

Plus de réponses (0)

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by