My problem is to minimize a target function with differential equations in it.

The target function is

$$min mathrm{J}left( p right) =sum_{i=1}^5{|x_ileft( p right) -y_i|},$$

where $x_i(p)$ are differential equations like this:

```
stateFunctionV(v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_) :=
{μ =
(67/100)(x2(t)/(x2(t) + 28/100))(1 - x3(t)/940)(1 - x4(t)/1050)^3 (1 - x5(t)/361);
x1'(t) == μ*x1(t),
x2'(t) == -(v1 + μ/v5)* x1(t),
x3'(t) == (v2 + μ*v6)*x1(t),
x4'(t) == (v3 + μ*v7)* x1(t),
x5'(t) == (v4 + μ*v8)* x1(t),
x1(0) == 0.2025, x2(0) == 441.337, x3(0) == 0, x4(0) == 0, x5(0) == 0}
```

and $y_i$ is the experiment data.

The code:

```
PIP1(value_) :=
{Sum(
Sum(
Abs(
NDSolveValue({
μ = (67/100)(x2(t)/(x2(t) + 28/100))(1 - x3(t)/940)(1 - x4(t)/1050)^3(1 - x5(t)/361);
x1'(t) == μ*x1(t),
x2'(t) == -(value((1)) + μ/value((5)))x1(t),
x3'(t) == (value((2)) + μ value((6)))x1(t),
x4'(t) == (value((3)) + μ value((7)))x1(t),
x5'(t) == (value((4)) + μ value((8)))x1(t),
x1(0) == 0.2025, x2(0) == 441.337, x3(0) == 0, x4(0) == 0,
x5(0) == 0}, {x1, x2, x3, x4, x5}, {t, 0, 6.5})((i))(data2((i, j, 1))) - data2((i, j, 2))),
{j, 1, 7}),
{i, 1, 5})}
NMinimize(PIP1({v1, v2, v3, v4, v5, v6, v7, v8}), {v1, v2, v3, v4, v5, v6, v7, v8})
```

doesn’t work. I also tried to take the differential functions out as a new function and it also failed.

So I wonder if there’s a way to minimize this problem with NMinimize or not? I would be grateful for your advice on how to couple `NMinimize`

and `NDSolveValue`

.

The experiment data are below:

```
data2 =
{{{0, 0.2025}, {2, 0.76}, {3, 1.28}, {4, 2.2}, {5, 2.75}, {6, 2.95}, {6.5, 3.055}},
{{0, 441.337}, {2, 400.435}, {3, 300.326}, {4, 219.348}, {5, 120.109}, {6, 50}, {6.5, 25}},
{{0, 0}, {2, 42.2895}, {3, 78.6579}, {4, 117.026}, {5, 152.158}, {6, 229.553}, {6.5, 224.1205}},
{{0, 0}, {2, 1.66667}, {3, 13.55}, {4, 16.6667}, {5, 22.7333}, {6, 34.4333}, {6.5, 71.2333}},
{{0, 0}, {2, 6.73913}, {3, 7.86957}, {4, 9.3913}, {5, 8.34783}, {6, 10.9565}, {6.5, 11.8261}}};
```