Apply fmincon nonlinear parameter inequality constraints into SimBiology for parameterization

1 view (last 30 days)
DavidSimon on 1 Dec 2023
Commented: DavidSimon on 5 Dec 2023
I am wanting to enter two nonlinear inequalities into a fitting program for SimBiology. I've built an ODE model and have been able to reproduce simulations of it with a set of constant parameters through the SimBiology app.
I am now hoping to parameterize my model using SimBiology and recreate the work that I've done outside of the app. That is, I have a separate OptimizeThis.m file where I used fmincon to parameterize my ODE model. Turns out it needed a couple constraints in order to give me a relevant set of parameters, thus my OptimizeThis file basically looks like the psuedo-code below:
params = [a1 a2 a3 a4 b1 b2 b3 b4] % Parameters to be optimized
lb = zeros(1,8); % Lower bounds
ub = ones(1,8); % Upper bounds
[param_estimates] = fmincon(@(p) theObjectiveFxn(p),params,[],[],[],[],lb,ub,@nonlincon);
function [c,ceq] = nonlincon(params)
a1 = params(1);
a2 = params(2);
a3 = params(3);
a4 = params(4);
b1 = params(5);
b2 = params(6);
b3 = params(7);
b4 = params(8);
%Nonlinear inequality constraints
c(1) = a1*a2 - b1*b3; % For the constraint b1*b3 >= a1*a2
c(2) = 4*a1*a2*b1*b4 - (b2*a3 - 1*b1*b3)^2; % For the constraint (b2*a3 - 1*b1*b3)^2 >= 4*a1*a2*b1*b4
%Nonlinear equality constraints
ceq=[];
end
To restate my question. How can I enter the nonlincon function above or just the two constraint equations (c(1) and c(2)) into SimBiology while using the fmincon estimation method?
The base and advanced algorithm settings don't appear to have an option for me to specify these constraints, and none of the rule options seem like the right tool to use as they appear to be all equalities and I want inequalities to be applied. I also don’t think I should create an event, since I want the constraints to hold throughout the parameterization.
6 CommentsShow 4 older commentsHide 4 older comments
Torsten on 2 Dec 2023
Edited: Torsten on 2 Dec 2023
I don't think anybody in the forum knows SimBiology good enough to answer your question. The easiest way seems for me to contact the developers (especially Arthur Goldsipe) via Technical Support.
DavidSimon on 4 Dec 2023
Duly noted. Thank you so much for your help.

Sign in to comment.

Accepted Answer

Arthur Goldsipe on 4 Dec 2023
The estimation program in the SimBiology Model Analyzer app uses the command-line function sbiofit. Unfortunately, this function does not currently support nonlinear constraints.
One workaround would be to use a custom program or script that calls fmincon directly. You would need to write your own objective function that simulates the model and calculates an appropriate objective (for example, the mean square error). If you decide to pursue this route, I recommend using SimBiology's SimFunction for simulations. It provides a function-like interface to simulations that should require less code than than alternatives.
Also, as Torsten mentioned, feel free to reach out to Tech Support or contact me via my community profile if you want more details. I personally would also like to hear more about your nonlinear constraints so I can think about to extend sbiofit to support them.
-Arthur
1 CommentShow -1 older commentsHide -1 older comments
DavidSimon on 5 Dec 2023
Absolutely, Arthur. If you have the time, I have no issue speaking with you about my constraints in more detail. Thank you for your direct answer too.
I do have another program that incorporates fmincon as you suggest, but I don't use the SimFunction for simulations. I may consider that in the very near future.
My hope was to move my model over to SImBiology for parameter sweeps/sensitivity analysis. I think I might still be able to do that, but I'll have to think on that some more.

Sign in to comment.

Communities

More Answers in the  SimBiology Community

Categories

Find more on Import Data in Help Center and File Exchange

R2021a

Community Treasure Hunt

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

Start Hunting!