How can I perform optimization over a discrete set of possible values in MATLAB?
조회 수: 26 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 4월 7일
편집: MathWorks Support Team
2021년 3월 4일
I would like to run an optimization to determine the best resistors for my circuit. Currently I am setting upper and lower bounds of the possible resistor values, solving the optimization in a continuous manner using "fmincon", and then mapping the solution to the nearest resistor value I have in stock. For example, the possible values may be something like: {15.5, 20, 27.2, 31.1, 33}.
Is there a way in MATLAB to solve this optimization problem directly considering the possible values, instead of solving the continuous problem and then picking the closest value?
채택된 답변
MathWorks Support Team
2021년 3월 4일
편집: MathWorks Support Team
2021년 3월 4일
One way to approach this problem is to treat it like an optimization with Integer Constraints, where you actually solve for an index within the set possible solutions.
There are two primary optimization methods in MATLAB which support integer constraints: the Genetic Algorithm, and Linear Programming, although Linear Programming may not be a good fit for some problems. Even if you could implement an integer constraint on a function like "fmincon", the underlying algorithm would still search on a continuous space which does not make sense and is not efficient given the problem statement.
If the discrete solution space is small enough, you may even consider a direct search of all options, as opposed to some iterative optimization method. This approach may not be feasible if you have for example 40 possible resistor values and you are looking to solve for a vector of 8 resistor values. In such a situation, you end up with a search space of size 40^8 which is quite a few solutions to consider.
There is an example in the documentation which is quite similar to the described problem, and in this case the Genetic Algorithm is used with Discrete Non-Integer Constraints:
In this example, you can use the Genetic Algorithm to solve for an index, (i.e. 3) which then corresponds to some resistor value (i.e. 27.2). Given the inclusion of Integer Constraints, you will always find an exact index corresponding to one available resistor values, successfully implementing Discrete Non-Integer Variable Constraints on the optimization problem.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!