#!/bin/bash
for i in out/*yaml; do
    IN=${i/.pre.yaml/}
    IN=${IN/out\//}
    grep -q mip_value $i && continue
    grep $IN instances/opt.tab | awk '{ print "mip_value:\n  "$2 }' >> $i
done

printf "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n" instance cutsmir cutsw origgap mirperf wperf mircontrib wcontrib wimprov wtime > 'tables/gap.csv'
for i in out/*.yaml; do
    IN=${i/.yaml/}
    IN=${IN/out\//}
    printf "%s," $IN
    scripts/gap.rb $i
done | sed -e 's/,$//g' >> 'tables/gap.csv'

printf "%s,%s,%s,%s,%s,%s\n" instance cutsmir cutsw mirt wedget avgm > 'tables/speed.csv'
for i in out/*.yaml; do
    IN=${i/.yaml/}
    IN=${IN/out\//}
    printf "%s," $IN
    scripts/speed.rb $i
done | sort | sed -e 's/,$//g' >> 'tables/speed.csv'
