MATLAB Nonlinear Optimization with fmincon

This step-by-step tutorial demonstrates fmincon solver on a nonlinear optimization problem with one equality and one inequality constraint. Visit http://apmonitor.com/che263/index.php/Main/MatlabOptimization for source code.

Comments

Matheus Moreira says:

Congratulations for the video!
May you help me?
I have the following problem: I need to implement some nonlinear constraints, but they are another functions, with the same enter variables. How can I write the code in this case?

Wondemsegegn Zewdu says:

Proffesor John D. Hedengren, Thank you very much. All your videos are very heplfu to me.

Edmond A says:

Thanks for your video.
How do you set up your nonlinear constraints if they are in the form of sets of diferential equations, as in state space format?
I know it’s easy using APM, just curious to see how it’s done in MATLAB.

I believe that would render the problem from a pure optimization problem into an optimal control problem, am I correct?
Thanks

Diogo Oliveira says:

Thank you for your tutorials/videos. I need to find a minimum of function with 250 variables for mass balance. Could you advice me something please?

Aimal Rehman says:

Thank you very much

Romain Pryckodko says:

Thank you 🙂

rechel rechel says:

Hi Sir, I have tried to minimize the same equation using GA fortunately when testing the constraints we have the same output which is c=0 and c_eq =12 but when I test the main script unfortunately I didn’t get the same answer. Can you please enlighten me with situations like this? Thank you

venkatesh sarma says:

Sir, Thank you so much. You helped me for the take home part of my exam which is due submission tomorrow. I want to learn more about Matlab, from you(FREE, if possible). Would you be interested in helping me?

Vijay Kumar S says:

Thank a lot. It really helped me to solve my problem

Maroof Maroof says:

Thank you soooo much for this helpful video.I want to know how to add linear equality constraint with in the same function? i tried to make another function of equality constraint but its not working.if you can kindly help

Rohit Babu says:

Thank you very much. This is the great help for the beginners like me…

Eden Huang says:

Hi, how can I read values for constants or parameters from Matlab, I want to use APM as an NLP solver in Matlab script, so I need pass parameter from Matlab to APM?

ferdinando todaro says:

Good evening, i have to obtain the power Pp0, Pp1, Pp2 and Pp3 for a gain optimization. The equations are the following:

G1=exp(-alpha_s1*L+a1*Pp0+b1*Pp1+c1*Pp2+d1*Pp3);
G2=exp(-alpha_s2*L+a2*Pp0+b2*Pp1+c2*Pp2+d2*Pp3);
G3=exp(-alpha_s3*L+a3*Pp0+b3*Pp1+c3*Pp2+d3*Pp3);
G1=exp(-alpha_s4*L+a4*Pp0+b4*Pp1+c4*Pp2+d4*Pp3);

a1,a2,a3,a4,b1,b2,b3,b4,c1,c2,c3,c4,d1,d2,d3,d4,L and alpha_s1, alpha_s2,alpha_s3,alpha_s4 are constants.

How can i implement it?

Quinn. S. says:

Thanks for the video. I have a quick question, if you don’t mind.

For the ceq does the matlab fmincon assume that it is equal to 0?

For your c you had <=0 For your ceq you had = 0 But if both my constraints are <=0 can the fmincon still work as both seen as <=0 Because my final [c,c2] = nlcon(x) %c2 is ceq had the value of 0 for c2

Sohil Shah says:

Great video! Very well explained….thanks a lot for the efforts!

Au6oJluT says:

Thank you for your tutorials! I tried to find right article or video, but failed. Well, i need to fined a minimum of function with 40+ variables (it’s functional for nonlinear MPC). The function is nonlinear and has a lot of local minima. Could you advice me something please? I already tried a fmincon, ga in matlab. It gives some results but not what i expect.

p.s. I apologize for the mistakes, English is not my native language

ruhina begum says:

sir, i have linear equation A=a0+a1*B+a2*C+a3*D+a4*E , the coeficients values i know and i have (B,C,D,E) 5 values for each variable, i want to put A is constant then i want to find the optimum values of B,C,D,E how i can do please answer me

Akshay Gaikwad says:

how to put multiple nonlinear constraints ?

panaluu says:

Where do I find info finding x(0)? Maybe a dumb question but I don’t see where you got that?

shashank shekar mupparam says:

thanku for ur help i have strucked to relate this with relay coordination in power system coordination can u help me sir

Jeremy JK says:

Thanks for the video. I do have a question I wanted to ask.
Since the objective function in the video above is not convex(i think), and the Ceq is also not convex (not affine), it means the solution it gave is local minimum.
Suppose the inputs are all convex instead, does this guarantee the solution will be global minimum?

Niveditha Ponnapureddy says:

i need matlab coding with sub programs for crossover,mutation and selection
so plzzz help with these 3

nathan mezacasa says:

I have a problem with a system developed in Simulink. Is a militar tank with six road whels, 8 DOF. I want to optimize with Fmincon the bounce, but I don’t understand how to interconnect Simulink with fmincon. Can you help me? Do you have any material on this?
Thank you.

chamant swarup says:

what do you think is the best optimization algorithm for the houseload optimization problem with renewebles like PV with energy storage system ? Can you share any important mathematical formulations in the cases similar to same . I would like to ask a few more queries regarding optimization algorithms over email if u can send a test message to the given mail id or share ur mailid .
THANKS IN ADVANCE!!
Regards ,
CHAMANTH
chamanthevital@gmail.com

yup son says:

just after watching a vedio with more detailed explanations.. didn’t find this helpful

Zeyad Alabsy says:

Hello, Many thanks for that excellent presentation, But I have a question: What’s about if I want to optimize two equations or three simultaneously, For example what I am working on it nowadays, I’d like to optimize J = (xy – zt)^2 with respect to the for variables x, y , z and … which means optimizing the difference between their products, but at the same time, I would like to optimize the J1 = xy and J2 = zt. It means to optimize the difference of optimized multiplications. Is that possible ? which algorithm is usually used for that? Thank you so much in advance.

Jian Lu says:

Basically this solver is actually for convex problem optimization. I am wondering if there is any solver or functions in matlab which is to solve non-linear Mixed Integer programming? Thanks.

Knight Time says:

Thanks

ayoub madrid says:

thank you for these vidoes,and i’need airship model in simulink matlab can you make video for help

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!