Division by an OptimizationVariable not supported.

5 ビュー (過去 30 日間)
BOWEN LI
BOWEN LI 2019 年 7 月 27 日
編集済み: Matt J 2019 年 7 月 30 日
Hi everyone,
I met a problem that in my equation, there is a part where includes a division of two optimization varaibles. For example, if i let
y=optimvar('y',[4,1,4],'Type','integer','LowerBound',0,'UpperBound',1);
then my equation would be like: (1-yi)/sum(yi)
However, matlab says division of two optimization variable is not supported by optimization toolbox, while I don't think i can change the form of my equation. So I
'm wondering if it's possible to proceed.
Thank you!

採用された回答

Matt J
Matt J 2019 年 7 月 27 日
編集済み: Matt J 2019 年 7 月 27 日
The problem-based solver is largely limited to linear and (in R2019) quadratic programs. If you find yourself computing non-linear/non-quadratic OptimizationExpressions, it will typically mean that you have a more general optimization problem than that and must resort to another solver.
Or, you could try to reformulate your problem as a linear problem, but to know if that is possible, we would have to see the full problem, not just a single expression that occurs in it somewhere.
  5 件のコメント
BOWEN LI
BOWEN LI 2019 年 7 月 30 日
hi,I just got an idea that if it's possible to use fcn2optimexpr to convert my non-linear equations to be used by optimization toolbox?
for example, if i want to convert hb(t)
hb(t)=2*sqrt(2*(1-yi(1,:,t))*d/vb+sum((1-yi(1,:,t))*td)*ub./(sum((1-yi(:,:,t)).*qij(:,:,t))));
I may want to use fcn2optimexpr in this way:
hb(t)=fcn2optimexpr(@(2*sqrt(2*(1-yi(1,:,t))*d/vb+sum((1-yi(1,:,t))*td)*ub/(sum((1-yi(:,:,t)).*qij(:,:,t))))),yi);
but there's something wrong with the syntax tho.
Thank you!
Matt J
Matt J 2019 年 7 月 30 日
編集済み: Matt J 2019 年 7 月 30 日
Here is a list of Supported Operations on Optimization Expressions and Variables. You will have to go through your operations and see which are not on the list. It appears, for example, that sqrt is not there.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Problem-Based Optimization and Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by