This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Graphs | |
using PicoSAT | |
function optimal_coloring(g::SimpleGraph{T})::Graphs.Coloring{T} where {T <: Integer} | |
# FIXME which is faster: maximum clique or maximal clique? | |
max_clique = argmax(length, maximal_cliques(g)) | |
#max_clique = independent_set(complement(g), DegreeIndependentSet()) | |
#@show max_clique | |
for χ in length(max_clique):nv(g) | |
#println("Trying χ=$χ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Primes | |
using StatsBase | |
using InteractiveViz | |
using GLMakie | |
function run(L, turns, zoom) | |
function xy_to_grid(x, y) | |
return round(Integer, L/2 + x*zoom), round(Integer, L/2 + y*zoom) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Linux driver for B&K Precision 393 multimeter. | |
// g++ -Wall -Wextra -std=c++11 -o bk393 bk393.cc | |
// It currently points to /dev/ttyUSB0, but I'd recommend adding a udev rule to get a consistent device name: | |
// SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A60198LN", MODE="0664", GROUP="mygroup", SYMLINK+="bk393" | |
#include <boost/utility.hpp> | |
#include <array> | |
#include <iomanip> | |
#include <cstdio> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute the Lovasz, Schrijver, and Szegedy numbers for graphs. | |
# | |
# A graph with 32 vertices takes under one second, so it's not the fastest. | |
# Probably the specialized code for Lovasz number from | |
# http://dollar.biz.uiowa.edu/~sburer/pmwiki/pmwiki.php%3Fn=Main.SDPLR%3Faction=logout.html | |
# would be much faster (I haven't tried it). | |
# Copyright (c) 2013 Daniel Stahlke ([email protected]) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: this is just a proof of concept and breaks when, for example, you have | |
# parenthesis inside a quotation. I'm still trying to find the easiest way to | |
# handle this properly. Suggestions are welcome. | |
# | |
# An IPython extension for transparent use of joblib. | |
# To use, type something like this in IPython: | |
# [ x*2 parfor x in range(10) ] | |
# To use custom options, type this at the IPython prompt: | |
# _parfor = joblib.Parallel(n_jobs=-1, verbose=5) | |
# |