<commit_before>#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
#include <gecode/gist.hh>
#include <gecode/search.hh>

#include "dep_selector_to_gecode.h"

#include <limits>
#include <iostream>
#include <vector>

//#define DEBUG
//#define USE_DUMB_BRANCHING
#define VECTOR_CONSTRAIN

using namespace Gecode;
const int VersionProblem::UNRESOLVED_VARIABLE = INT_MIN;
const int VersionProblem::MIN_TRUST_LEVEL = 0;
const int VersionProblem::MAX_TRUST_LEVEL = 10;
const int VersionProblem::MAX_PREFERRED_WEIGHT = 10;

VersionProblem::VersionProblem(int packageCount)
  : size(packageCount), finalized(false), cur_package(0), package_versions(*this, packageCount), 
    disabled_package_variables(*this, packageCount, 0, 1), total_disabled(*this, 0, packageCount*MAX_TRUST_LEVEL),
    total_required_disabled(*this, 0, packageCount), total_induced_disabled(*this, 0, packageCount), 
    total_suspicious_disabled(*this, 0, packageCount),
    is_required(new int[packageCount]),
    is_suspicious(new int[packageCount]),
    at_latest(*this, packageCount, 0, 1),
    // These domains could be narrowed a bit; check later
    total_preferred_at_latest(*this, -packageCount*MAX_PREFERRED_WEIGHT, packageCount*MAX_PREFERRED_WEIGHT), 
    total_not_preferred_at_latest(*this, -packageCount, packageCount), 
    preferred_at_latest_weights(new int[packageCount]),
{
  for (int i = 0; i < packageCount; i++)
  {
    preferred_at_latest_weights[i] = 0;
    is_required[i] = 0;
    is_suspicious[i] = 0;
  }
}

VersionProblem::VersionProblem(bool share, VersionProblem & s) 
  : Space(share, s), size(s.size),
    finalized(s.finalized), cur_package(s.cur_package),
    disabled_package_variables(s.disabled_package_variables), total_disabled(s.total_disabled),
    total_required_disabled(s.total_required_disabled), total_induced_disabled(s.total_induced_disabled), 
    total_suspicious_disabled(s.total_suspicious_disabled),
    is_required(NULL), is_suspicious(NULL),
    at_latest(s.at_latest),
    total_preferred_at_latest(s.total_preferred_at_latest), 
    total_not_preferred_at_latest(s.total_preferred_at_latest), 
    preferred_at_latest_weights(NULL),
{
  package_versions.update(*this, share, s.package_versions);
  disabled_package_variables.update(*this, share, s.disabled_package_variables);
  total_disabled.update(*this, share, s.total_disabled);
  total_required_disabled.update(*this, share, s.total_required_disabled);
  total_induced_disabled.update(*this, share, s.total_induced_disabled);
  total_suspicious_disabled.update(*this, share, s.total_suspicious_disabled);
  at_latest.update(*this, share, s.at_latest);
  total_preferred_at_latest.update(*this, share, s.total_preferred_at_latest);
  total_not_preferred_at_latest.update(*this, share, s.total_not_preferred_at_latest);
}

// Support for gecode
Space* VersionProblem::copy(bool share)
{
  return new VersionProblem(share,*this);
}

VersionProblem::~VersionProblem() 
{
  delete[] preferred_at_latest_weights;<commit_msg>Fix syntax error.<commit_after>#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
#include <gecode/gist.hh>
#include <gecode/search.hh>

#include "dep_selector_to_gecode.h"

#include <limits>
#include <iostream>
#include <vector>

//#define DEBUG
//#define USE_DUMB_BRANCHING
#define VECTOR_CONSTRAIN

using namespace Gecode;
const int VersionProblem::UNRESOLVED_VARIABLE = INT_MIN;
const int VersionProblem::MIN_TRUST_LEVEL = 0;
const int VersionProblem::MAX_TRUST_LEVEL = 10;
const int VersionProblem::MAX_PREFERRED_WEIGHT = 10;

VersionProblem::VersionProblem(int packageCount)
  : size(packageCount), finalized(false), cur_package(0), package_versions(*this, packageCount), 
    disabled_package_variables(*this, packageCount, 0, 1), total_disabled(*this, 0, packageCount*MAX_TRUST_LEVEL),
    total_required_disabled(*this, 0, packageCount), total_induced_disabled(*this, 0, packageCount), 
    total_suspicious_disabled(*this, 0, packageCount),
    is_required(new int[packageCount]),
    is_suspicious(new int[packageCount]),
    at_latest(*this, packageCount, 0, 1),
    // These domains could be narrowed a bit; check later
    total_preferred_at_latest(*this, -packageCount*MAX_PREFERRED_WEIGHT, packageCount*MAX_PREFERRED_WEIGHT), 
    total_not_preferred_at_latest(*this, -packageCount, packageCount), 
    preferred_at_latest_weights(new int[packageCount])
{
  for (int i = 0; i < packageCount; i++)
  {
    preferred_at_latest_weights[i] = 0;
    is_required[i] = 0;
    is_suspicious[i] = 0;
  }
}

VersionProblem::VersionProblem(bool share, VersionProblem & s) 
  : Space(share, s), size(s.size),
    finalized(s.finalized), cur_package(s.cur_package),
    disabled_package_variables(s.disabled_package_variables), total_disabled(s.total_disabled),
    total_required_disabled(s.total_required_disabled), total_induced_disabled(s.total_induced_disabled), 
    total_suspicious_disabled(s.total_suspicious_disabled),
    is_required(NULL), is_suspicious(NULL),
    at_latest(s.at_latest),
    total_preferred_at_latest(s.total_preferred_at_latest), 
    total_not_preferred_at_latest(s.total_preferred_at_latest), 
    preferred_at_latest_weights(NULL)
{
  package_versions.update(*this, share, s.package_versions);
  disabled_package_variables.update(*this, share, s.disabled_package_variables);
  total_disabled.update(*this, share, s.total_disabled);
  total_required_disabled.update(*this, share, s.total_required_disabled);
  total_induced_disabled.update(*this, share, s.total_induced_disabled);
  total_suspicious_disabled.update(*this, share, s.total_suspicious_disabled);
  at_latest.update(*this, share, s.at_latest);
  total_preferred_at_latest.update(*this, share, s.total_preferred_at_latest);
  total_not_preferred_at_latest.update(*this, share, s.total_not_preferred_at_latest);
}

// Support for gecode
Space* VersionProblem::copy(bool share)
{
  return new VersionProblem(share,*this);
}

VersionProblem::~VersionProblem() 
{
  delete[] preferred_at_latest_weights;
{'fraction_non_alphanumeric': 0.1127434796962694, 'fraction_numerical': 0.005942555298778475, 'mean_word_length': 7.100267379679145, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '5989013', 'n_tokens_mistral': 2109, 'n_tokens_neox': 2001, 'n_words': 327}