<commit_before>/// HEADER
#include "optimization_dummy.h"

/// PROJECT
#include <csapex/msg/input.h>
#include <csapex/msg/output.h>
#include <csapex/utility/register_apex_plugin.h>
#include <utils_param/parameter_factory.h>
#include <csapex/model/node_modifier.h>

/// SYSTEM
//#include <boost/assign.hpp>

CSAPEX_REGISTER_CLASS(csapex::OptimizationDummy, csapex::Node)

using namespace csapex;
using namespace csapex::connection_types;


OptimizationDummy::OptimizationDummy()
{
}

void OptimizationDummy::setupParameters()
{
    addParameter(param::ParameterFactory::declareRange("a", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("b", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("c", -10.0, 10.0, 0.0, 0.1));
}

void OptimizationDummy::setup()
{
    in_  = modifier_->addInput<AnyMessage>("Trigger");
    out_ = modifier_->addOutput<double>("Fitness");
}

void OptimizationDummy::process()
{
    double a = readParameter<double>("a");
    double b = readParameter<double>("b");
    double c = readParameter<double>("c");

    ainfo << "params are a: " << a << ", b: " << b << ", c: " << c << std::endl;

    double fitness = std::pow(a-b, 2) + c;
    ainfo << "dummy optimizer: fitness = " << fitness;

    out_->publish(fitness);
}

<commit_msg>more complicated dummy model<commit_after>/// HEADER
#include "optimization_dummy.h"

/// PROJECT
#include <csapex/msg/input.h>
#include <csapex/msg/output.h>
#include <csapex/utility/register_apex_plugin.h>
#include <utils_param/parameter_factory.h>
#include <csapex/model/node_modifier.h>

/// SYSTEM
//#include <boost/assign.hpp>

CSAPEX_REGISTER_CLASS(csapex::OptimizationDummy, csapex::Node)

using namespace csapex;
using namespace csapex::connection_types;


OptimizationDummy::OptimizationDummy()
{
}

void OptimizationDummy::setupParameters()
{
    addParameter(param::ParameterFactory::declareRange("a", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("b", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("c", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("d", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("e", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("f", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("g", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("h", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("i", -10.0, 10.0, 0.0, 0.1));
    addParameter(param::ParameterFactory::declareRange("j", -10.0, 10.0, 0.0, 0.1));
}

void OptimizationDummy::setup()
{
    in_  = modifier_->addInput<AnyMessage>("Trigger");
    out_ = modifier_->addOutput<double>("Fitness");
}

void OptimizationDummy::process()
{
    double a = readParameter<double>("a");
    double b = readParameter<double>("b");
    double c = readParameter<double>("c");
    double d = readParameter<double>("d");
    double e = readParameter<double>("e");
    double f = readParameter<double>("f");
    double g = readParameter<double>("g");
    double h = readParameter<double>("h");
    double i = readParameter<double>("i");
    double j = readParameter<double>("j");

    ainfo << "params are a: " << a << ", b: " << b << ", c: " << c << std::endl;

//    double fitness = a*a + b*b + c*c;
    double fitness = (a - b) + c * d + e * (f - g) + i + j;
    ainfo << "dummy optimizer: fitness = " << fitness << std::endl;

    out_->publish(fitness);
}


{'fraction_non_alphanumeric': 0.19287095882840563, 'fraction_numerical': 0.03619784470848301, 'mean_word_length': 4.6918238993710695, 'pattern_counts': {'":': 0, '<': 70, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7383014', 'n_tokens_mistral': 1374, 'n_tokens_neox': 1289, 'n_words': 235}