Optimization Formulation for "Complex" Constraints

2 次查看(过去 30 天)
Hello,
I am currently looking into solving an optimization problem using fmincon(). The problem is:
For this problem, fij's and tau_j's are the variables to be optimized. qobs_jk is a given, and q_jk is calculated as
where delta_t and I_ik are givens - the unknowns being optimized are tau and f.
My confusion stems from the following points/questions:
  1. I am not sure how to treat the inputs tau and f into fmincon() because the objective function is not explicitly a function of tau or f.
  2. How do I model the inequality constraint that contains a summation? Also, I need to satisfy this constraint for all i - can I do that in a single constraint?
  3. Can the solver handle two (one of which is multi-dimensional) variable solutions? The optimal f_ij array should be of size (i x j) and the optimal tau_j array should be of size (j x 1).
I am fairly familiar with Matlab but brand new to using the optimization toolbox. Any help with formulating this problem using fmincon or guidance toward understanding how to formulate it correctly would be greatly appreciated.

采纳的回答

Matt J
Matt J 2021-6-30
编辑:Matt J 2021-6-30
I am not sure how to treat the inputs tau and f into fmincon() because the objective function is not explicitly a function of tau or f.
Isn't it? In your formula for q_jk, all the tau's and f's appear on the right hand side. Anyway, the only thing that matters to fmincon is that you provide a function that will compute z for any given guess of the unknowns f and tau. It doesn't know or care what steps the function has to go through to reach z.
How do I model the inequality constraint that contains a summation?
That's what the Aineq,bineq arguments to fmincon are for.
Also, I need to satisfy this constraint for all i - can I do that in a single constraint?
No, you need n_i of them.
Can the solver handle two (one of which is multi-dimensional) variable solutions? The optimal f_ij array should be of size (i x j) and the optimal tau_j array should be of size (j x 1).
I would recommend, first of all, making a change of variables and replace exp(delta t/tau_j) with a single variable theta_j to simplify the computations and make them more linear. To answer your question though, f and tau (or f and theta) must be passed to your objective function bundled together in a single array unknowns. You can, of course, unpack them into separate variables within your objective function, if you wish.
To make it simpler to set this up, however, you can use some of the Optimization Toolbox tools for Problem-Based Optimization Setup together with the function prob2matrices() which must be downloaded. This will allow you to set up the optimization as below (where the blanks are for you to fill in):
f=optimvar('f',[ni,np],'LowerBound',0);
theta=optimvar('theta',np,'LowerBound',0,'UpperBound',1);
con.sumbound=sum(f,2)<=1;
sol0.f=____; %Initial guesses
sol0.theta=___;
[p,idx]=prob2matrices({f,theta},'Constraints',con,'x0',sol0);
fun=@(unknowns) zfun(unknowns,idx, I, qobj);
unknowns = fmincon(fun,p.x0,p.Aineq,p.bineq,[],[],p.lb,p.ub);
sol=x2sol(unknowns,idx);
f=sol.f; %final solutions
theta=sol.theta;
function z=zfun(unknowns,idx, I, qobj)
sol=x2sol(unknowns,idx);
f=sol.f;
theta=sol.theta;
Q=f.'*I;
q=nan(size(Q));
q(:,1)=_____;
for k=2:size(I,2)
q(:,k)=q(:,k-1).*theta + (1-theta).*Q(:,k);
end
z=norm(qobj-q,'fro').^2;
end
  7 个评论
Matt J
Matt J 2021-6-30
it would appear that both solutions give the same f's, but not the same tau's
But is the objective function approximately the same for both? If so, you simply have approximately non-unique solutions.
Corey Hoydic
Corey Hoydic 2021-6-30
The objective function is indeed approximately the same (for both theta and tau formulations AND for different initial guesses for f/tau/theta). The example problem I am using to debug this code is quite simple and idealized, so it will be interesting to see if there is non-uniqueness when applying this optimization to real data (I am working with oil well injection (I) and production (q) rates).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by