# nonlinear bounded constraints in fmincon

1 回表示 (過去 30 日間)
hussain askar 2021 年 10 月 27 日

I would like to add a nonlinear bounded constraint to my fmincon function i MATLAB, how can I break this constraint into two nonlinear inequality constraints? This is the ramp limit constraint used for generators
-DR<= p(i,t+1) - p(i,t) <= UR
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
hussain askar 2021 年 10 月 27 日
can i break it like this?
function [c,ceq] = mycon(p)
c = [-DR(i)-p(h+1,i)+p(h,i);p(h+1,i)-p(h,i)-UR(i)];

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

### 回答 (1 件)

arushi 2024 年 4 月 12 日
Hi Hussain
You can break the ramp limit constraint into two nonlinear inequality constraints for use with MATLAB's fmincon function as you've described. The ramp limit constraint ensures that the change in power output between two time periods does not exceed specified down and up ramp limits, (DR) and (UR), respectively.
In fmincon, the nonlinear constraints function should return two outputs: c and ceq. Here, c represents the nonlinear inequality constraints which should be less than or equal to 0, and ceq represents the nonlinear equality constraints which should be equal to 0.
Your proposed function looks correct with a minor adjustment for indexing clarity and ensuring it matches MATLAB's 1-based indexing. Just make sure that DR(i) and UR(i) are correctly defined for each generator i, and that p is indexed correctly considering MATLAB's indexing. Also, ensure you adjust h and i according to your loop or vectorization structure.
Hope this helps.

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

### カテゴリ

Help Center および File ExchangeWrite Objective Function についてさらに検索

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by