フィルターのクリア

Formulation of Optimization Function - MIN (SUM [ (P+X)^2 ])

2 ビュー (過去 30 日間)
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 18 日
コメント済み: Stephan 2018 年 10 月 19 日
Dear community,
I am currently and repeatedly struggling with the formulation of an optimization function for Matlab's CPLEX API. I guess there aren't many around with distinct CPLEX experience, however, this case should basically be the same as with fmincon, linprog and other Matlab Toolbox solvers.
I am trying to formulate the following function in CPLEX syntax:
MIN (SUM [ (P+X)^2 ])
,with P being a given scalar vector in the dimension of 1x8760 and X being the variable to be optimized (same dimension).
The standard syntax however is given always as follows:
min f*x
It seems to me that this must be simple. However, I just can't find an approach here. I must confess that I have very little experience in optimization, even less with CPLEX.
Thankful for every bit of help.
Best, Mathias

採用された回答

Stephan
Stephan 2018 年 10 月 18 日
編集済み: Stephan 2018 年 10 月 18 日
Hi,
i do not know CPLEX - but if i would have to do this with Optimization Toolbox i would use:
f_val = @(X)obj_func(X,P);
function result = obj_func(X,P)
result = sum((P+X).^2);
end
The function should be at the end of the script or be saved in a .m-file named obj_func.m.
The min is not needed for Optimization Toolbox, since the solvers do this by theirself. I dont know how CPLEX behaves at this point.
Best regards
Stephan
  2 件のコメント
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 10 月 19 日
編集済み: Mathias Dirksmeier 2018 年 10 月 19 日
Hi, sorry, I just found a proper solution. There is a specific solver to this problem:
[x,resnorm] = cplexlsqmilp(C,d,...)
I guess apart from Cplex your solution would have worked.
Stephan
Stephan 2018 年 10 月 19 日
I wish you success!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by