Skip to content

Instantly share code, notes, and snippets.

@MHenderson
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save MHenderson/a2cc887ee45b17b4e53d to your computer and use it in GitHub Desktop.

Select an option

Save MHenderson/a2cc887ee45b17b4e53d to your computer and use it in GitHub Desktop.
Greedy colouring of Queen Graphs.
#!/bin/bash
for (( i=1; i<=$1; i++ ))
do
echo $RANDOM
done
# To use sed -n -f get_colours.sed queen13_13.col.res > output.txt
s/CLRS \([0-9]\+\) [A-Z a-z = 0-9 .]*/\1/p
src_dir:=~/workspace/graphs-collection/src/Colouring/Trick
generate_seeds:=./generate_seeds
simulation:=./simulation2
get_colours:=get_colours.sed
output:=output.txt
approx:=chromatic_approx.txt
seeds:=seeds.txt
problem_file:=$(src_dir)/queen16_16.col
result_file=$(addsuffix .res, $(problem_file))
iterations:=1000
type:=simple
ordering:=lbfsr
chromatic_approx.txt: $(output)
sort -n $< | head -n 1 > $@
output.txt: $(get_colours) $(result_file)
sed -n -f $< $(result_file) > $@
$(result_file): $(problem_file) $(seeds)
$(simulation) $(seeds) $(type) $(ordering) $<
$(seeds):
$(generate_seeds) $(iterations) > $(seeds)
clean:
rm -f $(approx)
rm -f $(output)
rm -f $(result_file)
rm -f $(seeds)
#!/bin/bash
# First parameter is number of iterations
# Second parameter is type
# Third parameter is ordering
# Fourth parameter is filename
for (( i=1; i<=$1; ++i ))
do
ccli greedy --type=$2 --ordering=$3 --seed=$RANDOM $4
done
#!/bin/bash
# First parameter is number of iterations ## BROKEN
# Second parameter is type
# Third parameter is ordering
# Fourth parameter is filename
parallel -j2 --eta ccli greedy --type=$2 --ordering=$3 --seed={1} $4 :::: $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment