Info

This question is closed. Reopen it to edit or answer.

Need Urgent Help!!! How can i manipulate nonlinear constraints for optimization in GUI?

2 views (last 30 days)
I'm creating a GUI of a optimization program using fmincon which needs objective and nonlinear inequality constraint functions in files ObjectiveFunct.m
function Cost = ObjectiveFunct(x)
(...)
end
and Nonlin_Cons.m
function [c,ceq] = Nonlin_Cons(x)
g1 = f1(x);
g2 = f2(x);
g3 = f3(x);
c = [g1 g2 g3];
ceq = [] % no nonlinear equality constraints
end
My GUI contains a group of 3 check-boxes correspondingly to nonlinear constraints g1, g2 and g3 and a pushbutton As default c = [g1 g2 g3]. When i push my pushbutton to execute callback function
function pushbutton1_Callback(hObject, eventdata, handles)
(...)
x0 = [1 2 3 4]
[x,fval,exitflag,output]=fmincon(@ObjectiveFunct,x0,...,@Nonlin_Cons,option)
firstly, I need my GUI to check for selected nonlinear constraints and exclude non-selected constraint from c (for example: checkbox1 is not selected, then c = [g2 g3] and so on). Thanks! (you can mail me to omonua99@gmail.com)

Answers (0)

Community Treasure Hunt

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

Start Hunting!