Here is what I ran, worked on 2024-05-27:
sudo apt update
sudo apt install postgresql
sudo service postgresql start
sudo visudo
add following line to end of file:
Here is what I ran, worked on 2024-05-27:
sudo apt update
sudo apt install postgresql
sudo service postgresql start
sudo visudo
add following line to end of file:
import cvxpy as cp | |
import math | |
def compute_hi(rankings): | |
"""Compute h_i(a) for all voters and alternatives.""" | |
hi = [] | |
for ranking in rankings: | |
h = {} | |
for a in ranking: | |
h[a] = set(ranking[:ranking.index(a)+1]) |
// usage: node mes.js <path-to-pb-file> | |
const fs = require('fs'); | |
const readline = require('readline'); | |
function parsePBFile(filePath) { | |
return new Promise((resolve, reject) => { | |
const meta = {}; | |
const projects = {}; | |
const votes = {}; |
For arXiv, run
latexpand --empty-comments --keep-includes --expand-bbl document.bbl document.tex > document-arxiv-v1.tex
Website version style
\documentclass[11pt]{scrartcl}
\usepackage[a4paper, total={16cm, 24cm}]{geometry}
\usepackage{authblk}
# Adapted from https://github.com/martinlackner/abcvoting/blob/6aacadb0e3e70e4f83a82225b05730f72a6230d4/abcvoting/generate.py#L166 | |
def mallows(reference_ranking, dispersion): | |
distributions = [] | |
for i in range(len(reference_ranking)): | |
distributions.append([dispersion ** (i - j) for j in range(i + 1)]) | |
while True: | |
vote = [] | |
for i in range(len(reference_ranking)): | |
pos = random.choices(range(i + 1), weights=distributions[i], k=1)[0] |
def nash(N, A, u, rounds=500): | |
"N is set of voters, A is set of alternatives, u is a utility dictionary" | |
"where u[i,x] >= 0 is the utility of i for x, usually either 0 or 1" | |
p = {x : 1/len(A) for x in A} | |
for _ in range(rounds): | |
q = {x : 0 for x in A} | |
for i in N: | |
util = sum(u[i,x] * p[x] for x in A) | |
for x in A: | |
q[x] += (1/len(N)) * (u[i,x] * p[x]) / util |
# first install pdftk. For recent MacOS version, get it here: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg | |
import os | |
os.system(f"pdftk input.pdf output uncompressed.pdf uncompress") | |
with open("fixed.pdf", "wb") as outfile: | |
for line in open("uncompressed.pdf", "rb"): | |
patterns = [ | |
b"This content downloaded from", |
I often use Texpad on documents that use the microtype package which makes texpad fall back to PDFLaTeX. Instead I want Texpad to ignore the included package. Here is a way to do this, by adding a fake empty local microtype package.
Make a folder with a fake microtype package:
mkdir .fakemicrotype
echo "\ProvidesPackage{microtype}" > .fakemicrotype/microtype.sty
Add the new folder to the TexpadTex search path: (Command+Shift+. to show hidden files in the folder picker)
# to use, customize values in [[BRACKETS]] and add the password as a secret in the repo settings | |
name: Build LaTeX document | |
on: [push] | |
jobs: | |
build_latex: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v2 | |
- name: Compile LaTeX document |