# how to optimize a function which optimization variable is not in it directly?

4 ビュー (過去 30 日間)
Sara Rajaee 2019 年 7 月 17 日
Answered: Walter Roberson 2019 年 7 月 25 日
there is a function in the picture which I should optimize it. Dm and I are matrixes . I has an indirect role in cacules of this function. how can I do that in matlab

#### 0 件のコメント

サインイン to comment.

### 件の回答 (2)

Alan Weiss 2019 年 7 月 19 日
This looks like a binary programming problem. I don't know how the D_m depend on the I_{n,k}, but it looks like there is no big issue. Use intlinprog for the solution, or the problem-based approach.
Alan Weiss
MATLAB mathematical toolbox documentation

#### 3 件のコメント

Sara Rajaee 2019 年 7 月 21 日
thanks for your answer, I used problem-based approach for optimization, but I have a problem that I can't use mathematical caclus on optimization varible like X, for exmaple I can't find maximum element of X with "max (X)" and I get an error "Error using max
Invalid data type. First argument must be numeric or logical" or do division.
best regards
Walter Roberson 2019 年 7 月 21 日
There is nothing in the formula that you posted that involves max()?
Sara Rajaee 2019 年 7 月 25 日
yeah, I have not posted all of the question here, but in part of that there are some max() function.

サインイン to comment.

Walter Roberson 2019 年 7 月 25 日
If you are using max and it is a discrete programming problem then try all of the possible input combinations and pick the best results.
If trying all of the possible inputs is not feasible (for example too slow above 2^40 possibilities) then ga()
fmincon cannot be used for discrete variables. intlinprog cannot be used when max() appears in the formula or constraints.
Sometimes instead of using max it can be feasible to run several slightly different problems, each assuming that one of the possibilities is the max, and then to take the result in which the max was true.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by