function dydt = seir_model(t, y, params, N, fixed_gamma, fixed_delta)
dS = -beta * S * (q * E + I) / N;
dE = beta * S * (q * E + I) / N - fixed_delta * E;
dI = fixed_delta * E - fixed_gamma * I;
function y = gmmp_scheme(f, y0, t, params, N, fixed_gamma, fixed_delta)
yi_next = yi + (ti^(params(3)-1) - (i-1)^(params(3)-1)) * f(ti, yi, params, N, fixed_gamma, fixed_delta);
function error = objective_function(params, f, y0, t, data, N, fixed_gamma, fixed_delta)
y = gmmp_scheme(f, y0, t, params, N, fixed_gamma, fixed_delta);
infected_model = y(3, :);
error = sum((infected_model - data).^2);
function estimated_params = mgam(f, y0, t, data, N, fixed_gamma, fixed_delta)
param_guess = [0.5, 0.5, 0.5];
obj_func = @(params) objective_function(params, f, y0, t, data, N, fixed_gamma, fixed_delta);
options = optimoptions('ga', 'Display', 'iter', 'PopulationSize', 50);
[estimated_params, ~] = ga(obj_func, 3, [], [], [], [], [0, 0, 0], [1, 1, 1], [], options);
data = y0(3) * exp(0.05 * (t - t0));
estimated_params = mgam(@seir_model, y0, t, data, N, fixed_gamma, fixed_delta);
Single objective optimization:
3 Variables
Options:
CreationFcn: @gacreationuniform
CrossoverFcn: @crossoverscattered
SelectionFcn: @selectionstochunif
MutationFcn: @mutationadaptfeasible
Best Mean Stall
Generation Func-count f(x) f(x) Generations
1 100 1.628e+15 1.628e+15 0
2 147 1.628e+15 1.628e+15 0
3 194 1.628e+15 1.628e+15 0
4 241 1.628e+15 1.628e+15 1
5 288 1.628e+15 1.628e+15 0
6 335 1.628e+15 1.628e+15 1
7 382 1.628e+15 1.628e+15 2
8 429 1.628e+15 1.628e+15 0
9 476 1.628e+15 1.628e+15 1
10 523 1.628e+15 1.628e+15 2
11 570 1.628e+15 1.628e+15 0
12 617 1.628e+15 1.628e+15 0
13 664 1.628e+15 1.628e+15 1
14 711 1.628e+15 1.628e+15 0
15 758 1.628e+15 1.628e+15 1
16 805 1.628e+15 1.628e+15 2
17 852 1.628e+15 1.628e+15 3
18 899 1.628e+15 1.628e+15 4
19 946 1.628e+15 1.628e+15 5
20 993 1.628e+15 1.628e+15 0
21 1040 1.628e+15 1.628e+15 1
22 1087 1.628e+15 1.628e+15 0
23 1134 1.628e+15 1.628e+15 0
24 1181 1.628e+15 1.628e+15 0
25 1228 1.628e+15 1.628e+15 0
26 1275 1.628e+15 1.628e+15 1
27 1322 1.628e+15 1.628e+15 2
28 1369 1.628e+15 1.628e+15 3
29 1416 1.628e+15 1.628e+15 4
30 1463 1.628e+15 1.628e+15 5
Best Mean Stall
Generation Func-count f(x) f(x) Generations
31 1510 1.628e+15 1.628e+15 0
32 1557 1.628e+15 1.628e+15 0
33 1604 1.628e+15 1.628e+15 1
34 1651 1.628e+15 1.628e+15 0
35 1698 1.628e+15 1.628e+15 1
36 1745 1.628e+15 1.628e+15 0
37 1792 1.628e+15 1.628e+15 1
38 1839 1.628e+15 1.628e+15 2
39 1886 1.628e+15 1.628e+15 0
40 1933 1.628e+15 1.628e+15 1
41 1980 1.628e+15 1.628e+15 0
42 2027 1.628e+15 1.628e+15 0
43 2074 1.628e+15 1.628e+15 1
44 2121 1.628e+15 1.628e+15 0
45 2168 1.628e+15 1.628e+15 0
46 2215 1.628e+15 1.628e+15 1
47 2262 1.628e+15 1.628e+15 0
48 2309 1.628e+15 1.628e+15 0
49 2356 1.628e+15 1.628e+15 1
50 2403 1.628e+15 1.628e+15 2
51 2450 1.628e+15 1.628e+15 3
ga stopped because the average change in the fitness value is less than options.FunctionTolerance.
beta = estimated_params(1);
alpha = estimated_params(3);
fprintf('Estimated Parameters:\n');
fprintf('Beta: %.2f\n', beta);
fprintf('Alpha: %.2f\n', alpha);
y = gmmp_scheme(@seir_model, y0, t, [beta, q, alpha], N, fixed_gamma, fixed_delta);
plot(t, y(3, :), 'r-', 'LineWidth', 2);
title('SEIR Model Simulation');