How to maximize a function if I have both integer and continuous variables?

1 visualización (últimos 30 días)
Mr M.
Mr M. el 26 de Oct. de 2018
Comentada: Mr M. el 29 de Oct. de 2018
How to maximize a function if I have both integer and continuous variables? What is the right syntax? I have to use constraints for handling integer variables?

Respuestas (2)

Matt J
Matt J el 26 de Oct. de 2018
Editada: Matt J el 26 de Oct. de 2018
If the objective and constraints are linear you can use intlinprog(). Otherwise, you would have to resort to ga(). Each of these solvers has an input argument 'IntCon', which you use to specify which variables are integer and which are not.

Jeff Miller
Jeff Miller el 27 de Oct. de 2018
Here is an adaptation of fminsearch that allows you to mix both integer and continuous variables: fminsearcharb. It probably won't work well if you have a lot of variables, though.

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by