<commit_before>let Simulation = require('./simulation')
let modules = require('./strategies')
let min = 14226 // 0.1 USD
let max = 142251558 // 1000 USD

let results = []

for (var name in modules) {
  let f = modules[name]
  let simulation = new Simulation(name, f, 56)
  let utxos = Simulation.generateTxos(1000, min * 10, max * 10)
  utxos.forEach(x => simulation.addUTXO(x))

  // 100 rounds
  for (let i = 0; i < 100; ++i) {
    let outputs = Simulation.generateTxos(1, min, max / 4)
    outputs.forEach(x => (x.address = 'A'))

    simulation.run(outputs)
  }

  results.push(simulation)
}

function pad (i) {
  if (typeof i === 'number') i = Math.round(i * 1000) / 1000
  return ('          ' + i).slice(-10)
}

// sort by transactions ASCENDING
// then fees DESCENDING
results.sort((a, b) => {
  if (a.stats.transactions !== a.stats.transactions) return a.stats.transactions - b.stats.transactions
  return b.stats.fees - a.stats.fees
}).forEach(x => {
  let { stats } = x
  let nIT = stats.inputs / stats.transactions
  let nOT = stats.outputs / stats.transactions
  let fT = stats.failed / stats.transactions

  console.log(
    pad(stats.name),
    '| fA', pad('' + stats.fees),
    '| NIT', pad(nIT),
    '| NOT', pad(nOT),
    '| DNF', Math.round(100 * fT) + '%'
  )
})<commit_msg>fix DNF calculation<commit_after>let Simulation = require('./simulation')
let modules = require('./strategies')
let min = 14226 // 0.1 USD
let max = 142251558 // 1000 USD

let results = []

for (var name in modules) {
  let f = modules[name]
  let simulation = new Simulation(name, f, 56)

  // 10 UTXOs, min 10 USD, max 10000 USD
  let utxos = Simulation.generateTxos(20, min * 100, max * 10)
  utxos.forEach(x => simulation.addUTXO(x))

  // 500 transactions, min 0.1USD, max 500 USD
  for (let i = 0; i < 500; ++i) {
    let outputs = Simulation.generateTxos(1, min, max / 2)
    outputs.forEach(x => (x.address = 'A'))

    simulation.run(outputs)
  }

  results.push(simulation)
}

function pad (i) {
  if (typeof i === 'number') i = Math.round(i * 1000) / 1000
  return ('          ' + i).slice(-10)
}

// sort by transactions ASCENDING
// then fees DESCENDING
results.sort((a, b) => {
  if (a.stats.transactions !== a.stats.transactions) return a.stats.transactions - b.stats.transactions
  return b.stats.fees - a.stats.fees
}).forEach(x => {
  let { stats } = x
  let nIT = stats.inputs / stats.transactions
  let nOT = stats.outputs / stats.transactions
  let fT = stats.failed / (stats.failed + stats.transactions)

  console.log(
    pad(stats.name),
    '| fA', pad('' + stats.fees),
    '| NIT', pad(nIT),
    '| NOT', pad(nOT),
    '| DNF', Math.round(100 * fT) + '%'
  )
})
{'fraction_non_alphanumeric': 0.16511367871785315, 'fraction_numerical': 0.04360790160268356, 'mean_word_length': 2.994047619047619, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6046563', 'n_tokens_mistral': 1079, 'n_tokens_neox': 970, 'n_words': 256}