<commit_before>#include <vector>

#include "../../include/ppddl/PPDDLState.h"

#include "../../include/solvers/FFUtil.h"
#include "../../include/solvers/RFFSolver.h"

using namespace std;

namespace mlsolvers

{

// TODO: For now, the GFF set will be only the goal. Modify this.
mlcore::Action* RFFSolver::solve(mlcore::State* s0)
{
                                                                                mdplib_debug = true;
    startingPlanningTime_ = time(nullptr);
    terminalStates_.insert(s0);
    mlcore::StateSet statesPolicyGraph;

    for (int i = 0; i < 10; i++) {
        mlcore::StateSet expandedStates;
        mlcore::StateSet newTerminalStates;
        for (mlcore::State* s : terminalStates_) {
            // Solving using FF
            vector<string> fullPlan;
            vector<mlcore::State*> subgoals;
//                                                                                dprint1("here0");
            if (!statesPolicyGraph.empty())
                pickRandomStates(statesPolicyGraph, 100, subgoals);
                                                                                dprint2("calling FF ", subgoals.size());
            callFF(s, subgoals, fullPlan);
                                                                                dprint2("done with plan of size ", fullPlan.size());

            // Extract policy
            mlcore::State* sPrime = s;
            for (string actionName : fullPlan) {
                // Don't expand goal states or states that have been expanded
                // before
                                                                                dprint3("trying", sPrime, (void *) sPrime->bestAction());
                if (problem_->goal(sPrime) ||
                        statesPolicyGraph.count(sPrime) > 0)
                    continue;<commit_msg>rff now checks if the state has an action ready before solving it<commit_after>#include <vector>

#include "../../include/ppddl/PPDDLState.h"

#include "../../include/solvers/FFUtil.h"
#include "../../include/solvers/RFFSolver.h"

using namespace std;

namespace mlsolvers

{

mlcore::Action* RFFSolver::solve(mlcore::State* s0)
{
                                                                                mdplib_debug = true;
    if (s0->bestAction() != nullptr)
        return s0->bestAction();
    startingPlanningTime_ = time(nullptr);
    terminalStates_.insert(s0);
    mlcore::StateSet statesPolicyGraph;

    for (int i = 0; i < 10; i++) {
        mlcore::StateSet expandedStates;
        mlcore::StateSet newTerminalStates;
        for (mlcore::State* s : terminalStates_) {
            // Solving using FF
            vector<string> fullPlan;
            vector<mlcore::State*> subgoals;
//                                                                                dprint1("here0");
            if (!statesPolicyGraph.empty())
                pickRandomStates(statesPolicyGraph, 100, subgoals);
                                                                                dprint2("calling FF ", subgoals.size());
            callFF(s, subgoals, fullPlan);
                                                                                dprint2("done with plan of size ", fullPlan.size());

            // Extract policy
            mlcore::State* sPrime = s;
            for (string actionName : fullPlan) {
                // Don't expand goal states or states that have been expanded
                // before
                                                                                dprint3("trying", sPrime, (void *) sPrime->bestAction());
                if (problem_->goal(sPrime) ||
                        statesPolicyGraph.count(sPrime) > 0)
                    continue;
{'fraction_non_alphanumeric': 0.10340244550770866, 'fraction_numerical': 0.007974481658692184, 'mean_word_length': 1.2573485302939411, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '891850', 'n_tokens_mistral': 917, 'n_tokens_neox': 871, 'n_words': 213}