<commit_before>/* vim: set sw=4 sts=4 et foldmethod=syntax : */

#include <solver/solver.hh>

#include <graph/graph.hh>
#include <graph/dimacs.hh>
#include <graph/power.hh>
#include <graph/is_clique.hh>
#include <graph/is_club.hh>

#include <max_clique/naive_max_clique.hh>
#include <max_clique/mcsa1_max_clique.hh>
#include <max_clique/tmcsa1_max_clique.hh>
#include <max_clique/bmcsa_max_clique.hh>
#include <max_clique/tbmcsa_max_clique.hh>
#include <max_clique/cco_max_clique.hh>

#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>

#include <iostream>
#include <exception>
#include <cstdlib>
#include <chrono>
#include <thread>

using namespace parasols;
namespace po = boost::program_options;

namespace
{
    auto run_with_power(MaxCliqueResult func(const Graph &, const MaxCliqueParams &)) ->
        std::function<MaxCliqueResult (const Graph &, MaxCliqueParams &, bool &, int)>
    {
        return run_this_wrapped<MaxCliqueResult, MaxCliqueParams, Graph>(
                [func] (const Graph & graph, const MaxCliqueParams & params) -> MaxCliqueResult {
                    if (params.power > 0)
                        return func(power(graph, params.power), params);
                    else
                        return func(graph, params);
                });
    }
}

auto main(int argc, char * argv[]) -> int
{
    auto algorithms = {
        std::make_tuple( std::string{ "naive" },      run_with_power(naive_max_clique) ),
        std::make_tuple( std::string{ "mcsa1" },      run_with_power(mcsa1_max_clique) ),
        std::make_tuple( std::string{ "bmcsa1" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "bmcsa3" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::ExDegree>) ),
        std::make_tuple( std::string{ "bmcsar" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::DynExDegree>) ),

        std::make_tuple( std::string{ "ccon1" },      run_with_power(cco_max_clique<CCOPermutations::None, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccod11" },     run_with_power(cco_max_clique<CCOPermutations::Defer1, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccod21" },     run_with_power(cco_max_clique<CCOPermutations::Defer2, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccos1" },      run_with_power(cco_max_clique<CCOPermutations::Sort, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccon2" },      run_with_power(cco_max_clique<CCOPermutations::None, MaxCliqueOrder::MinWidth>) ),<commit_msg>Don't do a power raise for 1<commit_after>/* vim: set sw=4 sts=4 et foldmethod=syntax : */

#include <solver/solver.hh>

#include <graph/graph.hh>
#include <graph/dimacs.hh>
#include <graph/power.hh>
#include <graph/is_clique.hh>
#include <graph/is_club.hh>

#include <max_clique/naive_max_clique.hh>
#include <max_clique/mcsa1_max_clique.hh>
#include <max_clique/tmcsa1_max_clique.hh>
#include <max_clique/bmcsa_max_clique.hh>
#include <max_clique/tbmcsa_max_clique.hh>
#include <max_clique/cco_max_clique.hh>

#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>

#include <iostream>
#include <exception>
#include <cstdlib>
#include <chrono>
#include <thread>

using namespace parasols;
namespace po = boost::program_options;

namespace
{
    auto run_with_power(MaxCliqueResult func(const Graph &, const MaxCliqueParams &)) ->
        std::function<MaxCliqueResult (const Graph &, MaxCliqueParams &, bool &, int)>
    {
        return run_this_wrapped<MaxCliqueResult, MaxCliqueParams, Graph>(
                [func] (const Graph & graph, const MaxCliqueParams & params) -> MaxCliqueResult {
                    if (params.power > 1)
                        return func(power(graph, params.power), params);
                    else
                        return func(graph, params);
                });
    }
}

auto main(int argc, char * argv[]) -> int
{
    auto algorithms = {
        std::make_tuple( std::string{ "naive" },      run_with_power(naive_max_clique) ),
        std::make_tuple( std::string{ "mcsa1" },      run_with_power(mcsa1_max_clique) ),
        std::make_tuple( std::string{ "bmcsa1" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "bmcsa3" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::ExDegree>) ),
        std::make_tuple( std::string{ "bmcsar" },     run_with_power(bmcsa_max_clique<MaxCliqueOrder::DynExDegree>) ),

        std::make_tuple( std::string{ "ccon1" },      run_with_power(cco_max_clique<CCOPermutations::None, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccod11" },     run_with_power(cco_max_clique<CCOPermutations::Defer1, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccod21" },     run_with_power(cco_max_clique<CCOPermutations::Defer2, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccos1" },      run_with_power(cco_max_clique<CCOPermutations::Sort, MaxCliqueOrder::Degree>) ),
        std::make_tuple( std::string{ "ccon2" },      run_with_power(cco_max_clique<CCOPermutations::None, MaxCliqueOrder::MinWidth>) ),
{'fraction_non_alphanumeric': 0.1382020318190531, 'fraction_numerical': 0.0070921985815602835, 'mean_word_length': 4.130776794493609, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 69, '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': '6173650', 'n_tokens_mistral': 1906, 'n_tokens_neox': 1843, 'n_words': 286}