limits of Optimization variable can be another variable in problem based optimization?

I have optimization variable named PbattV1 in problem based optimization
Pmax1=10;
PbattV1 = optimvar('PbattV1',N,'LowerBound',0,'UpperBound',Pmax1);
As per optimvar help, Pmax1 (UpperBound) should be scalar. Now i want to change Pmax1= 10*a
where 'a' is another variable 0<a<1, is it possible to do it in problem based optimization and define 'a ' is a nother optimal variable ?

1 件のコメント

Matt J
Matt J 2022 年 8 月 9 日
As per optimvar help, Pmax1 (UpperBound) should be scalar
No, it doesn't have to be a scalar. It must be a constant, however.

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

 採用された回答

Matt J
Matt J 2022 年 8 月 9 日
編集済み: Matt J 2022 年 8 月 9 日
No, you must use a linear inequality constraint:
PbattV1 = optimvar('PbattV1',N,'LowerBound',0);
prob.Constraints.conName=(PbattV1<=10*a);

2 件のコメント

Thanks MJ from JM . its really helpful.
Matt J
Matt J 2022 年 8 月 9 日
You're welcome, but please Accept-click the answer to indicate that it resolved your question.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProblem-Based Optimization Setup についてさらに検索

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by