Clear Filters
Clear Filters

nonlinear bounded constraints in fmincon

1 view (last 30 days)
hussain askar
hussain askar on 27 Oct 2021
Answered: arushi on 12 Apr 2024
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 Comment
hussain askar
hussain askar on 27 Oct 2021
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)];

Sign in to comment.

Answers (1)

arushi on 12 Apr 2024
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.




Community Treasure Hunt

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

Start Hunting!