Borrar filtros
Borrar filtros

Subfunctions in optimization objective function

4 visualizaciones (últimos 30 días)
Angshuman Podder
Angshuman Podder el 22 de Jul. de 2020
Editada: Matt J el 23 de Jul. de 2020
Hi, I am trying to use the fmincon function for a minimization problem.
I am trying to minimize the total gibbs energy of the system (objective function) but the function requires calculation of activities (which are modelled by a sub function). Can we use the general framework of fmincon to compute the optimization function?
For e.g
I want to optimize n(i) to get min(G)
G = n(1)*G(1) + n(1)*R*T*log(a1) + n(2)*G(2) + n(2)*R*T*log(a2) + ...... n(i)*G(i) + n(i)*R*T*log(ai)
Here, ai is the activity given by f(ni/(n1 + n2 + .... + ni)).
Will the current framework compute the activities at each iteration to produce the optimized value? Or do I have to reframe the problem? Or is there a better way?

Respuesta aceptada

Matt J
Matt J el 23 de Jul. de 2020
Editada: Matt J el 23 de Jul. de 2020
fmincon does not know or care about the internals of your objective function code. You can do anything there, and call whatever subfunctions you wish, as long as the input/output relationship of the overall routine is that of a twice continuously differentiable function. The same with any nonlinear constraint functions you might supply.
In case it matters, though, note that fmincon will treat your unknown n(i) variables as continuous variables. You have no way of constraining the optimized n(i) to be integers, for example.
  3 comentarios
Matt J
Matt J el 23 de Jul. de 2020
Editada: Matt J el 23 de Jul. de 2020
This statement does baffle me because the fmincon should be able to do constraint optimizations since I definitely want n(i) to be positive integers.
Those aren't the kind of constraints fmincon supports. For integer-constrained non-linear optimization, you would have to use ga(). But it might be worthwhile to first solve with fmincon without integer constraints and then provide that solution as one of the population of initial guesses to ga().
So, what you are saying is that the principal variables i.e. n(i) can be cast into other variables to be used by other sub functions in the objective function?
Yes, the only thing fmincon cares about is that it can call a function y=f(n) with a guess of the n(i) and receive back a value y to be minimized ... and that that function be twice differentiable.
Angshuman Podder
Angshuman Podder el 23 de Jul. de 2020
Thank you so much. On a second thought, I guess the moles need not be integers but positive numbers.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by