I need to fit the sum of two populations defined by two different partial equations depending onto 3 parameters to a list of measurements of type (mesurement, time) using GEKKO. The differential equations are:
dS/dt = (a - b) * S
dR/dt = (a - b - c)* R
X(t) = S(t) + R(t)
(a,b,c are parameters)
I need to fit X to the measurements
Here are sample measured
Xvalues:Gekko adjusts the parameters
a,b, andc.The value of
Xis calculated with differential equations forSandRand an algebraic equation withX=S+R.The squared error between the measured
Xvalues and the predictedXvalue is minimized.A few configuration parameters are needed to run in dynamic estimation mode (
IMODE=5) and with 3 collocation nodes per time step (NODES=3).This produces an optimized solution that minimizes the squared error, but is not unique because
aandbare co-linear parameters. The solver can increaseaandband get the same answer.Here is the complete script:
Additional example problems are available from the Dynamic Optimization course.