Optimization problem - solving problem within a loop

조회 수: 1 (최근 30일)
Muzammil Ali
Muzammil Ali 2019년 7월 9일
댓글: Muzammil Ali 2019년 7월 29일
I have a function in which I am using a loop and also discretisation in time. It is solving a PDE using Fully implicit backward method. I want to know how to define the objective function as the values are changing within the loop with time. Also how do I specify the variables which need to be modified for optimisation.
Thank you.

답변 (1개)

Yogesh Khurana
Yogesh Khurana 2019년 7월 29일
You can use Optimization Expressions for defining objective functions and its variables inside a for-loop. Refer to the following link for more information:
Hope it helps!
  댓글 수: 1
Muzammil Ali
Muzammil Ali 2019년 7월 29일
I have two variables to optimise and I put it in the following form:
ratio = optimvar('ratio',1,1,'LowerBound',0,'UpperBound',1);
Dsw = optimvar('Dsw',1,1,'LowerBound',0,'UpperBound',1e-9);
But I get the following error:
Undefined function 'exp' for input arguments of type 'optim.problemdef.OptimizationExpression'.
Error in drying_optimisation_function (line 409)
DwsA=Dsw(1)*(exp(ratio(1)*(1-1/(1-((1-cf./(1+cf))*rhodropA/rhosolid))))*exp(-1.39e5*(exp(-3.32*(1-cf./(1+cf))))/8.314*(1/Tp(k)-1/298)));

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by