<commit_before>// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-

/* This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Authors:
 * <NAME> <<EMAIL>>
 */

#ifndef _EVOLVER_EASY_H_
#define _EVOLVER_EASY_H_

#include "Base.h"

namespace dim
{
    namespace evolver
    {
	template <typename EOT>
	class Easy : public Base<EOT>
	{
	public:
	    Easy(eoEvalFunc<EOT>& eval, eoMonOp<EOT>& op) : _eval(eval), _op(op) {}

	    void operator()(core::Pop<EOT>& pop, core::IslandData<EOT>& /*data*/)
	    {
#if __cplusplus > 199711L
		for (auto &ind : pop)
		    {
#else
		for (size_t i = 0; i < pop.size(); ++i)
		    {
			EOT& ind = pop[i];
#endif

			EOT candidate = ind;

			_op( candidate );

			// candidate.invalidate(); // temporaly disabled for debug
			_eval( candidate );

			if ( candidate.fitness() > ind.fitness() )
			    {
				ind = candidate;
			    }
		    }
	    }

	private:
	    eoEvalFunc<EOT>& _eval;
	    eoMonOp<EOT>& _op;
	};
    } // !evolver
} // !dim

#endif /* _EVOLVER_EASY_H_ */<commit_msg>* src/dim/evolver/Easy.h: added a boolean in order to disable invaliation for simu<commit_after>// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-

/* This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Authors:
 * <NAME> <<EMAIL>>
 */

#ifndef _EVOLVER_EASY_H_
#define _EVOLVER_EASY_H_

#include "Base.h"

namespace dim
{
    namespace evolver
    {
	template <typename EOT>
	class Easy : public Base<EOT>
	{
	public:
	    Easy(eoEvalFunc<EOT>& eval, eoMonOp<EOT>& op, bool invalidate = true) : _eval(eval), _op(op) _invalidate(invalidate) {}

	    void operator()(core::Pop<EOT>& pop, core::IslandData<EOT>& /*data*/)
	    {
#if __cplusplus > 199711L
		for (auto &ind : pop)
		    {
#else
		for (size_t i = 0; i < pop.size(); ++i)
		    {
			EOT& ind = pop[i];
#endif

			EOT candidate = ind;

			_op( candidate );

			if (_invalidate)
			    {
				candidate.invalidate();
			    }

			_eval( candidate );

			if ( candidate.fitness() > ind.fitness() )
			    {
				ind = candidate;
			    }
		    }
	    }

	private:
	    eoEvalFunc<EOT>& _eval;
	    eoMonOp<EOT>& _op;
	    bool _invalidate;
	};
    } // !evolver
} // !dim

#endif /* _EVOLVER_EASY_H_ */
{'fraction_non_alphanumeric': 0.12125617912183774, 'fraction_numerical': 0.01512067461471358, 'mean_word_length': 3.0046565774155995, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '80015', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1140, 'n_words': 391}