Cómo podría agregar una restricción sobre una variable dependiente en lugar de los parámetros a optimizar?
20 ビュー (過去 30 日間)
古いコメントを表示
Guillermo Ramirez Aguilar
2024 年 11 月 5 日 22:47
編集済み: Walter Roberson
2024 年 11 月 5 日 23:09
Tengo un código que representa la cristalización en serie utilizando la misma cinética de crecimiento/nucleación para los cinco cristalizadores, siendo estos parámetros los que se están optimizando para encontrar el tamaño de partícula promedio en el quinto cristalizador (único dato disponible para diferentes sets).
La situación es que en diferentes optimizaciones, el tamaño promedio de partícula en el quinto cristalizador es menor que en el primero, cuando en realidad debería estar creciendo.
Actualmente utilizo lsqnonlin, y veo que existe la posibilidad de agregar restricciones pero sobre los parámetros, ¿de qué forma podría hacerse sobre una variable dependiente de tal forma "Promedio 1ro < Promedio 5to"?
1 件のコメント
Walter Roberson
2024 年 11 月 5 日 22:56
Approximate translation:
How could I add a constraint on a dependent variable instead of the parameters to be optimized?
I have a code that represents serial crystallization using the same growth/nucleation kinetics for all five crystallizers, these parameters being optimized to find the average particle size in the fifth crystallizer (only data available for different sets).
The situation is that in different optimizations, the average particle size in the fifth crystallizer is smaller than in the first, when it should actually be growing.
I currently use lsqnonlin, and I see that there is the possibility of adding constraints but about the parameters, how could it be done on a dependent variable in such a way "Average 1st < Average 5th"?
採用された回答
Walter Roberson
2024 年 11 月 5 日 23:08
編集済み: Walter Roberson
2024 年 11 月 5 日 23:09
You would use the nonlcon parameter to add constraints.
You would likely use a function to calculate size of the fifth crystallizer, and call that function from both the objective function and the nonlinear constraints function. But in the nonlinear constraints function you would return a decision based on what was calculated.
Note that the objective function is potentially called before the nonlinear constraint function with the same parameters. It is also potentially possible that the objective function is never called with exactly the same parameters as the nonlinear constraint function. It is possible, for example, for the results of the nonlinear constraints to be used to adjust the parameters used to calculate the objective function.
If calculating the crystallizations is expensive, then you can consider using memoize -- that way, if the objective function is called with exactly the same parameters as the nonlinear constraint function, the results of crystallization will already be available.
crys_fun = memoize(@calculate_crystallizations);
crys_fun.CacheSize = 25;
objective_fun = @(parameters) calculate_objective(parameters, crys_fun);
nonlfun = @(parameters) calculate_nonlcon(parameters, crys_fun);
result = lsqnonlin(objective_fun, x0, lb, ub, A, b, Aeq, beq, nonlfun);
function result = calculate_objective(parameters, crys_fun)
crys = crys_fun(parameters);
...
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で ANOVA についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!