<commit_before>/*
 * correctness.cpp
 *
 *  Created on: Nov 19, 2014
 *      Author: matheus
 */

#include <cstdlib>
#include <ctime>

#include "ConcreteGraph.hpp"
#include "Helpers.hpp"
#include "GraphAlgorithms.hpp"
#include "ThreadManager.hpp"

using namespace std;
using namespace graph;

static int max_order = 20;
static int max_weight = 50;
static float edge_prob = 0.8f;
static int graphs = 100;

static inline bool generateAndCompare() {
  IntArrayGraphMapNeighbourHood G;
  
  // [2, max_order] vertices, weights in [1, max_weight]
  generateGraph(G, rand()%(max_order - 1) + 2, max_weight, edge_prob);
  
  IntAllPairsShortestPaths res1(G, IntDijkstra());
  IntAllPairsShortestPaths res2(G, IntSerialDeltaStepping(1));
  IntAllPairsShortestPaths res3(G, IntParallelDeltaStepping(1));
  
  return (res1 == res2) && (res2 == res3);
}

void correctness(int argc, char** argv) {
  srand(time(nullptr));
  ThreadManager::init(1);
  
  int i = 0;
  for (; i < graphs && generateAndCompare(); i++);
  if (i < graphs) {
    printf("error! some algorithm is wrong\n");
  }
  
  ThreadManager::close();
}<commit_msg>Now correctness uses 3 threads<commit_after>/*
 * correctness.cpp
 *
 *  Created on: Nov 19, 2014
 *      Author: matheus
 */

#include <cstdlib>
#include <ctime>

#include "ConcreteGraph.hpp"
#include "Helpers.hpp"
#include "GraphAlgorithms.hpp"
#include "ThreadManager.hpp"

using namespace std;
using namespace graph;

static int max_order = 20;
static int max_weight = 50;
static float edge_prob = 0.8f;
static int graphs = 100;

static inline bool generateAndCompare() {
  IntArrayGraphMapNeighbourHood G;
  
  // [2, max_order] vertices, weights in [1, max_weight]
  generateGraph(G, rand()%(max_order - 1) + 2, max_weight, edge_prob);
  
  IntAllPairsShortestPaths res1(G, IntDijkstra());
  IntAllPairsShortestPaths res2(G, IntSerialDeltaStepping(1));
  IntAllPairsShortestPaths res3(G, IntParallelDeltaStepping(1));
  
  return (res1 == res2) && (res2 == res3);
}

void correctness(int argc, char** argv) {
  srand(time(nullptr));
  ThreadManager::init(3);
  
  int i = 0;
  for (; i < graphs && generateAndCompare(); i++);
  if (i < graphs) {
    printf("error! some algorithm is wrong\n");
  }
  
  ThreadManager::close();
}
{'fraction_non_alphanumeric': 0.13505108840515326, 'fraction_numerical': 0.027099067081297203, 'mean_word_length': 4.533169533169533, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '71004', 'n_tokens_mistral': 829, 'n_tokens_neox': 787, 'n_words': 204}