Optimisation- having variable objective function

Guys I have a problem in preparing both Objective and Constraint Function. Type of problem: Minimising with Non-linear Constraint Imagine I want to minimise an objective function which is a function of Omega and Omega=1:10 (assume). The objective function has 3 variable (X1 X2 X3) which are the optimisation’s variable and needs to be find by optimisation tools. Similar to objective function, I have a constrain function (which is again a function of Omega and has X1 X2 X3 inside). I know Matlab can deal with problems called semi-infinite constraints, however, my objective function is similar to the constrains (in case of having Omega). Any advice is highly appreciated.

1 Comment

hello Nima please i have a system with 2 delays d1 and d2 which are the optimisation’s variable and needs to be find by optimisation tools. Similar to objective function, I have a constrain function (which is again a function of x and has d1 d2 (reals valors) inside).. a help please??

Sign in to comment.

Answers (1)

See the documentation on passing extra parameters

5 Comments

Dear Matt
Thanks for your response. This is very useful option. However, it doesn't work for a range of variable. Let's say, in the example (inside the link you gave) instead of having p1 = 1; I want to have something like p1=1:10 and just consider that we have p1 in both O.F. and C. If I use p1=1:10 , then I get Error using fmincon (line 674) User supplied objective function must return a scalar value. Just bear in mind that I have a set of O.F which each links to one non-linear constrain. I mean, imagine, my both objective function and constraints are frequency dependant (e.g. H(w)) and both have X1 X2 X3. Now I need to minimise this while for each frequency,let's say for instance w1, O.F is to minimise H(w1) by optimising X1 X2 X3 where H(w1)-C(w)<0 . Thanks
You're not meant to pass the entire vector p1=1:10 to the OF and constraints. You're meant to loop over the values of p1, and re-solve the problem for each value:
for i=1:length(p1)
OF=@(x) f(x,p1(i));
nlconst=@(x) c(x,p1(i));
X(:,i)=fmincon(OF,x0,...,nlconst,...);
%x0=X(:,i); initializing with the last solution may speed things up.
end
Mat
thanks for this
Just a point, then does it optimize my variable according to all OFs at the same time. Meaning that if imaging from p1(1), I've got X1 X2 X3 optimised, then does this X1 X2 X3 consider on other p1(i+1)? or for each p1(i) I would get individual X1 X2 X3?
kindest regards
Nima
Matt J
Matt J on 14 Nov 2012
Edited: Matt J on 14 Nov 2012
In the code that I outlined for you, only p1(i) gets used by the OF and therefore only p1(i) will affect X(:,i). However, I outlined this because it sounded like what you wanted: a different solution [X1,X2,X3] for every p1(i).
please i have a system with 2 delays d1 and d2 which are the optimisation’s variable and needs to be find by optimisation tools. Similar to objective function, I have a constrain function (which is again a function of x and has d1 d2 (reals valors) inside).. a help please??

Sign in to comment.

Products

Asked:

on 9 Nov 2012

Commented:

yem
on 14 Dec 2014

Community Treasure Hunt

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

Start Hunting!