forked from panditanvita/BTCpredictor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
objfun.m
executable file
·37 lines (33 loc) · 1.5 KB
/
objfun.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function: S_MSE= objfun(FVr_temp, S_struct)
% Author: Rainer Storn
% Description: Implements the cost function to be minimized.
% Parameters: FVr_temp (I) Paramter vector
% S_Struct (I) Contains a variety of parameters.
% For details see Rundeopt.m
% Return value: S_MSE.I_nc (O) Number of constraints
% S_MSE.FVr_ca (O) Constraint values. 0 means the constraints
% are met. Values > 0 measure the distance
% to a particular constraint.
% S_MSE.I_no (O) Number of objectives.
% S_MSE.FVr_oa (O) Objective function values.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function S_MSE= objfun(FVr_temp, S_struct)
load reg
y = size(regressorX);
% y(2) is the number of features
theta=zeros(y(2) ,1);
for i=1:y(2)
theta(i)=FVr_temp(i);
end
theta0=FVr_temp(y(2)+1);
F_cost=norm((regressorY' - (regressorX*theta + theta0)));
%
% %---Peaks function----------------------------------------------
% F_cost = peaks(FVr_temp(1),FVr_temp(2));
%----strategy to put everything into a cost function------------
S_MSE.I_nc = 0;%no constraints
S_MSE.FVr_ca = 0;%no constraint array
S_MSE.I_no = 1;%number of objectives (costs)
S_MSE.FVr_oa(1) = F_cost;
end