
function [ fitness ] = calculateFitnessSimple(Nc, times, center, data, m)
    
    % This function calculate the fitness function of OLYMPUS

    % ------------------------------------------------------------------- %
    % Input : Nc     = Number of Clusters
    %         times  = time points
    %         center = Centers of clusters
    %         data   = Data Set
    %         m      = fuzziness
    %         
    % Output: fitness = Value of fitness function (as mentioned in Eq. 8)    
    % ------------------------------------------------------------------- %

    % ------------------------------------------------------------------- %    
    % DImensions of Data Set
    N = size(data, 1);
    Nt = size(data, 2);    
    % Calculate partition matrix U 
    [~, U] = calculatePartition(Nc, times, center, data, m, 1);
    % Convert vector V (Clusters Centers) to a matrix (time series X Number of Clusters)
    V = reshape(center, Nt, Nc)';
    pd = zeros(Nc, Nt);
    % Calculate fitness function (Eq. 8)
    for i=1:Nc
        for j=1:N
            S = 0;          
            for k=1:Nt-1
                S = S + (((V(i, k+1)-V(i,k)) - (data(j, k+1) - data(j, k)))/(times(k+1)-times(k))).^2; 
            end
            pd(i,k) = S*(U(i, j)^m);
        end
    end
    fitness = abs(sum(sum(pd)));
    % ------------------------------------------------------------------- %
end