Apply fmincon nonlinear parameter inequality constraints into SimBiology for parameterization
Show older comments
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 Comments
function [c,ceq] = nonlincon(params)
%Nonlinear inequality constraints
c(1) = params(1)*params(2) - params(5)*params(7); % For the constraint b1*b3 >= a1*a2
c(2) = 4*params(1)*params(2)*params(5)*params(8) - (params(6)*params(3) - 1*params(5)*params(7))^2; % For the constraint (b2*a3 - 1*b1*b3)^2 >= 4*a1*a2*b1*b4
%Nonlinear equality constraints
ceq=[];
end
DavidSimon
on 1 Dec 2023
Moved: Torsten
on 2 Dec 2023
But you still didn't change your function definition:
function [c,ceq] = nonlincon(params)
instead of
[c,ceq] = function nonlincon(params)
DavidSimon
on 1 Dec 2023
Moved: Torsten
on 2 Dec 2023
DavidSimon
on 4 Dec 2023
Accepted Answer
More Answers (0)
Communities
More Answers in the SimBiology Community
Categories
Find more on Scan Parameter Ranges in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!