<commit_before>#include "ompl/control/planners/syclop/GridDecomposition.h"

ompl::control::GridDecomposition::GridDecomposition(const int len, const int dim, const base::RealVectorBounds &b) :
    Decomposition(len*len, b), length(len), dimension(dim)
{
    cellVolume = 1.0;
    for (int i = 0; i < dim; ++i)
        cellVolume *= (b.high[i] - b.low[i]) / len;
}

ompl::control::GridDecomposition::~GridDecomposition()
{
}

double ompl::control::GridDecomposition::getRegionVolume(const int rid) const
{
    return cellVolume;
}

/* This implementation requires time linear with the number of regions.
 * We can do constant time if we know the dimension offline (oopsmp-syclop has cases for 2 and 3),
 * but can we beat linear time with arbitrary dimension? */
void ompl::control::GridDecomposition::getNeighbors(const int rid, std::vector<int>& neighbors)
{
    std::cout << "neighbors of " << rid << ":" << std::endl;
    for (int s = 0; s < getNumRegions(); ++s)
    {
        if (areNeighbors(rid, s))
        {
            neighbors.push_back(s);
            std::cout << s << std::endl;
        }
    }
    std::cout << "done" << std::endl;
}

int ompl::control::GridDecomposition::locateRegion(const std::vector<double> coord)
{
    int region = 0;
    int factor = 1;
    for (int i = coord.size()-1; i >= 0; --i)
    {
        const int index = (int) (length*(coord[i]-bounds.low[i])/(bounds.high[i]-bounds.low[i]));
        region += factor*index;
        factor *= length;
    }
    return region;
}

bool ompl::control::GridDecomposition::areNeighbors(int r, int s)
{
    if (r == s)
        return false;
    std::vector<int> rc;
    std::vector<int> sc;
    regionToCoord(r, rc);
    regionToCoord(s, sc);
    for (int i = 0; i < dimension; ++i)
    {
        if (abs(rc[i]-sc[i]) > 1)<commit_msg>removed extra print statements from region location<commit_after>#include "ompl/control/planners/syclop/GridDecomposition.h"

ompl::control::GridDecomposition::GridDecomposition(const int len, const int dim, const base::RealVectorBounds &b) :
    Decomposition(len*len, b), length(len), dimension(dim)
{
    cellVolume = 1.0;
    for (int i = 0; i < dim; ++i)
        cellVolume *= (b.high[i] - b.low[i]) / len;
}

ompl::control::GridDecomposition::~GridDecomposition()
{
}

double ompl::control::GridDecomposition::getRegionVolume(const int rid) const
{
    return cellVolume;
}

/* This implementation requires time linear with the number of regions.
 * We can do constant time if we know the dimension offline (oopsmp-syclop has cases for 2 and 3),
 * but can we beat linear time with arbitrary dimension? */
void ompl::control::GridDecomposition::getNeighbors(const int rid, std::vector<int>& neighbors)
{
    for (int s = 0; s < getNumRegions(); ++s)
    {
        if (areNeighbors(rid, s))
        {
            neighbors.push_back(s);
        }
    }
}

int ompl::control::GridDecomposition::locateRegion(const std::vector<double> coord)
{
    int region = 0;
    int factor = 1;
    for (int i = coord.size()-1; i >= 0; --i)
    {
        const int index = (int) (length*(coord[i]-bounds.low[i])/(bounds.high[i]-bounds.low[i]));
        region += factor*index;
        factor *= length;
    }
    return region;
}

bool ompl::control::GridDecomposition::areNeighbors(int r, int s)
{
    if (r == s)
        return false;
    std::vector<int> rc;
    std::vector<int> sc;
    regionToCoord(r, rc);
    regionToCoord(s, sc);
    for (int i = 0; i < dimension; ++i)
    {
        if (abs(rc[i]-sc[i]) > 1)
{'fraction_non_alphanumeric': 0.15388983532084044, 'fraction_numerical': 0.0068143100511073255, 'mean_word_length': 3.306845965770171, 'pattern_counts': {'":': 1, '<': 33, '<?xml version=': 0, '>': 15, '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': '2650320', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1182, 'n_words': 308}