Discrete Optimization

Hi, is it possible to make an optimization with Matlab using discrete variable? Which kind of function can make it?
Thanks

2 个评论

Duplicate is at http://www.mathworks.com/matlabcentral/answers/13640-genetic-algorithm-optimization
Dear Walter,
Thank you, but there is no answer there either.

请先登录,再进行评论。

回答(3 个)

Walter Roberson
Walter Roberson 2020-11-10

1 个投票

ga() and gamultiobj() support discrete variables with general functions.
intlinprog supports discrete variables with matrix instead of function describing the objective.
There is some work with quadratic optimization that I had the impression could handle discrete variables when using Problem Based Optimization, but I did not track down which solver it uses.

3 个评论

Walter: "There is some work with quadratic optimization that I had the impression could handle discrete variables when using Problem Based Optimization,"
Really?
x=optimvar('x','type','integer');
y=optimvar('y','type','integer');
f=x^2+y^2;
prob = optimproblem("Objective",f);
solve(prob)
returns
>> Solving problem using lsqlin.
Error using optim.problemdef.OptimizationProblem/solve
Quadratic problem with integer variables not supported.
"Mixed-Integer Quadratic Programming Portfolio Optimization: Problem-Based"
Bruno Luong
Bruno Luong 2020-11-10
编辑:Bruno Luong 2020-11-10
It's interesting, but sorry it's not a solver. It's an example of how to solve a particular MIQP using relaxation. And this page one can read the warning "While this technique works for this example, it might not apply to different problem or constraint types.'
btw this technique can be well implemented with solver-based approach. This page just uses problem-based for illustration, but it is not a requirement.
It's like saying quadprog is a non-linear solver since newton method solves quadratic subproblem at each step, or mtimes is linear system solver since Gauss-Seidel relaxation method requires matrix-vector multiplication at each step.
MATLAB lacks a real MIQP solver.

请先登录,再进行评论。

PA00
PA00 2011-8-14

0 个投票

Can you expose more your problem? You can use "bintprog" when state variables are "1" or "0" like on or off but the method of optimization always depends on the problem itself and on the way you find to create a function to be minimized.
Mario
Mario 2011-8-14

0 个投票

Dear Pedro, thank you for the reply. I exposed my problem here http://www.mathworks.com/matlabcentral/answers/13640-genetic-algorithm-optimization . I was thinking to use a genetic algorithm, but before I start I want to be sure that it's the right choice.

类别

帮助中心File Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

提问:

2011-8-14

编辑:

2020-11-10

Community Treasure Hunt

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

Start Hunting!

Translated by