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

조회 수: 1 (최근 30일)
Mr M.
Mr M. 2018년 10월 26일
댓글: Mr M. 2018년 10월 29일
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?

답변 (2개)

Matt J
Matt J 2018년 10월 26일
편집: Matt J 2018년 10월 26일
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 2018년 10월 27일
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.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by