How to use "Optimize" task in Live Editor to solve discrete mixed integer problem-based optimization problem?

2 ビュー (過去 30 日間)

How to use "Optimize" task in Live Editor to solve discrete mixed integer problem-based optimization problem?
For example, I would like to define an optimization variable that only allow for discrete integer values to be possible solutions (e.g. 0,50,100). 

採用された回答

MathWorks Support Team
MathWorks Support Team 2024 年 11 月 19 日
To solve such problems, the "Optimize" task in the Live Editor can be used. Since the solution in mapped to custom integers (e.g. 0, 50, 100), the problem is not going to be linear anymore. Following are the steps to solve this problem:
1) Open Live Editor.
2) In the "Insert" menu, select task.
3) In the search bar in the dropdown, type "optimize" and select the task that comes up.
4) Select the "problem-based" option in "Select approach".
5) This opens the "optimize" live task that looks like this
6) Create your optimization variable and define the goal of the problem from the dropdown.
7) In "Objective", select "local function" and click on "New".
8) On clicking "New", the following code appears allowing you to add your objective function.
9) You can create an array of possible integer solutions and map it here. This is an example of a simple objective function
This live task selects "ga solver" for this problem by default. You can find the explanation for this by clicking on the question mark beside it in the "Specify problem-dependent-solver options" section. You can try different functionalities and options in this live task for your optimization problem.
To know more about "Optimize" task in live editor, please refer to the Optimize Live Editor Task documentation.

その他の回答 (0 件)

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by