Program Listing for File IVarialbeSelectable.h

Return to documentation for file (include/gwmodelpp/IVarialbeSelectable.h)

#ifndef IVARIALBESELECTABLE_H
#define IVARIALBESELECTABLE_H

#include <vector>
#include <sstream>
#include "Status.h"
#include "Logger.h"

namespace gwm
{

#define GWM_LOG_TAG_VARIABLE_CRITERION "#variable-criterion "

struct IVarialbeSelectable
{

    static std::string infoVariableCriterion()
    {
        return std::string(GWM_LOG_TAG_VARIABLE_CRITERION) + "variables,criterion";
    }

    static std::string infoVariableCriterion(const std::vector<std::size_t>& variables, const double criterion)
    {
        std::vector<std::string> var_labels(variables.size());
        std::transform(variables.cbegin(), variables.cend(), var_labels.begin(), [](const std::size_t& var)
        {
            return std::to_string(var);
        });
        return std::string(GWM_LOG_TAG_VARIABLE_CRITERION) + strjoin("+", var_labels) + "," + std::to_string(criterion);
    }

    virtual Status getCriterion(const std::vector<std::size_t>& variables, double& criterion) = 0;

    virtual std::vector<std::size_t> selectedVariables() = 0;

};

typedef std::vector<std::pair<std::vector<std::size_t>, double> > VariablesCriterionList;

}

#endif  // IVARIALBESELECTABLE_H