Example #1
0
matrix1d sum(matrix2d myVector) {
    matrix1d mySum(myVector.size(),0.0);

    for (int i=0; i<myVector.size(); i++) {
        for (int j=0; j<myVector[i].size(); j++) {
            mySum[i]+=myVector[i][j];
        }
    }
    return mySum;
}
Example #2
0
matrix1d mean2(matrix2d myVector) {
    matrix1d myMean(myVector[0].size(),0.0);

    for (int i=0; i<myVector.size(); i++) {
        for (int j=0; j<myVector[i].size(); j++) {
            myMean[j]+=myVector[i][j]/double(myVector.size());
        }
    }
    return myMean;
}
Example #3
0
matrix1d mean1(matrix2d myVector) {
    matrix1d myMean(myVector.size(),0.0);

    for (int i=0; i<myVector.size(); i++) {
        for (int j=0; j<myVector[i].size(); j++) {
            myMean[i]+=myVector[i][j];
        }
        myMean[i]/=double(myVector[i].size());
    }
    return myMean;
}
Example #4
0
matrix1d NeuroEvo::getAction(matrix2d state) {
    matrix1d stateSum(state[0].size(), 0.0);

    // state[type][state_element] -- specifies combination for state
    for (size_t i = 0; i < state.size(); i++) {
        for (size_t j = 0; j < state[i].size(); j++) {
            stateSum[j] += state[i][j];
        }
    }

    return getAction(stateSum);
}