-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjectiveFunc.c
More file actions
20 lines (19 loc) · 830 Bytes
/
objectiveFunc.c
File metadata and controls
20 lines (19 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "config.h"
double objectiveFunc(double param[Nparam]) {
int i;
double h;
double y[20] = {4.284, 4.149, 3.877, 0.533, 2.211, 2.389, 2.145,
3.231, 1.998, 1.379, 2.106, 1.428, 1.011, 2.179,
2.858, 1.388, 1.651, 1.593, 1.046, 2.152};
double x2[20] = {.286, .973, .384, .276, .973, .543, .957, .948, .543, .797,
.936, .889, .006, .828, .399, .617, .939, .784, .072, .889};
double x3[20] = {.645, .585, .310, .058, .455, .779, .259, .202, .028, .099,
.142, .296, .175, .180, .842, .039, .103, .620, .158, .704};
h = 0.0;
for (i = 0; i < 20; i++) {
h = ((param[0] + param[1] * x2[i] + (param[1] * param[1]) * x3[i] - y[i]) *
(param[0] + param[1] * x2[i] + (param[1] * param[1]) * x3[i] - y[i])) +
h;
}
return h;
}