Crate ben

Source
Expand description

This crate provides several command line tools and functions for converting ensembles of districting plans contained in a JSONL file with lines of the form

{"assignment": <assignment>, "sample": <sample>}

into binary ensembles (BEN) and extremely compressed binary ensembles (XBEN). It also provides several tools for working with these files including several tools for relabeling the ensembles to improve compression ratios.

The main CLI tools provided by this crate are:

  • ben: A tool for converting JSONL files into BEN files. and for converting between BEN and XBEN files.
  • reben: A tool for relabeling BEN files to improve compression ratios.

Modules§

decode
This module contains the main functions for decoding XBEN and BEN files.
encode
This module contains the main encoding functions for turning an input JSONL or BEN file into a BEN or XBEN file.
utils
This module provides some utility functions for working with assignments and RLE encoding. It also provides a function to sort a JSON file by a key so as to make the BEN encoding more efficient.

Macros§

log
logln

Enums§

BenVariant