diff --git a/experiments/assets/footer.document b/experiments/assets/footer.document deleted file mode 100644 index 6b47932..0000000 --- a/experiments/assets/footer.document +++ /dev/null @@ -1 +0,0 @@ -\end{document} diff --git a/experiments/assets/header.document b/experiments/assets/header.document deleted file mode 100644 index f2bc823..0000000 --- a/experiments/assets/header.document +++ /dev/null @@ -1,19 +0,0 @@ -\documentclass[11pt]{article} - -\usepackage{amssymb,amsfonts,amsmath} -\usepackage{fullpage} -\usepackage{booktabs} - -\usepackage{numprint} -\npdecimalsign{.} % we want . not , in numbers - -\newcommand{\AlgName}[1]{\ensuremath{\text{{\sf #1}}}} -\newcommand{\advanced}{\AlgName{Advanced}} -\newcommand{\simple}{\AlgName{Simple}} -\newcommand{\critical}{\AlgName{Critical}} -\newcommand{\maxcritical}{\AlgName{MaxCritical}} -\newcommand{\ai}{\AlgName{B\&R}} -\newcommand{\mcs}{\AlgName{MCS}} - - -\begin{document} diff --git a/experiments/erdos-biogrid/experiment.erdos-biogrid.sh b/experiments/erdos-biogrid/experiment.erdos-biogrid.sh index 02c5b84..8db02c7 100755 --- a/experiments/erdos-biogrid/experiment.erdos-biogrid.sh +++ b/experiments/erdos-biogrid/experiment.erdos-biogrid.sh @@ -1,41 +1,34 @@ #! /bin/bash time_out=3600 - -output_dir=erdos-biogrid.$time_out -experiment_name=erdos-biogrid - -data_dir=../../data/ -script_dir=../../scripts/ -erdos_data_set=$data_dir/erdos -biogrid_data_set=$data_dir/biogrid - -rm -rf old.$output_dir -mv $output_dir old.$output_dir - -mkdir $output_dir - -#erdos -$script_dir/graph.name.sh $erdos_data_set | tee $output_dir/erdos.name -$script_dir/graph.size.sh $erdos_data_set | tee $output_dir/erdos.graph.size -$script_dir/critical.size.sh $erdos_data_set $time_out | tee $output_dir/erdos.critical.size -$script_dir/maxcritical.size.sh $erdos_data_set $time_out | tee $output_dir/erdos.maxcritical.size -$script_dir/simple.size.time.sh $erdos_data_set $time_out | tee $output_dir/erdos.simple.size -$script_dir/advanced.size.time.sh $erdos_data_set $time_out| tee $output_dir/erdos.advanced.size - -# biogrid -$script_dir/graph.name.sh $biogrid_data_set | tee $output_dir/biogrid.name -$script_dir/graph.size.sh $biogrid_data_set | tee $output_dir/biogrid.graph.size -$script_dir/critical.size.sh $biogrid_data_set $time_out | tee $output_dir/biogrid.critical.size -$script_dir/maxcritical.size.sh $biogrid_data_set $time_out | tee $output_dir/biogrid.maxcritical.size -$script_dir/simple.size.time.sh $biogrid_data_set $time_out | tee $output_dir/biogrid.simple.size -$script_dir/advanced.size.time.sh $biogrid_data_set $time_out| tee $output_dir/biogrid.advanced.size - -cp header.erdos-biogrid $output_dir/ -cp footer.erdos-biogrid $output_dir/ - -cp mk_erdos_biogrid_table_data.py $output_dir/ -cd $output_dir -cat header.$experiment_name > erdos-biogrid.table.tex -python mk_erdos_biogrid_table_data.py >> erdos-biogrid.table.tex -cat footer.$experiment_name >> erdos-biogrid.table.tex +seeds=5 +seeds_minus_one=$((seeds - 1)) + +data_dir=../../data +script_dir=../../scripts + +experiments=(erdos biogrid) + +for item in ${experiments[*]}; do + output_dir=$item + rm -rf old.$output_dir + mv $output_dir old.$output_dir + mkdir $output_dir + data_set=$data_dir/$item + + for file_name in `ls -1 $data_set/*.graph`; do + temp=${file_name##*/} + temp=${temp%.*} + graph_name=$($script_dir/graph.name.sh $file_name) + graph_size=$($script_dir/graph.size.sh $file_name) + log_file=$output_dir/log.$temp + $script_dir/critical.size.sh $file_name $time_out | tee -a $log_file + $script_dir/maxcritical.size.sh $file_name $time_out | tee -a $log_file + $script_dir/simple.size.time.sh $file_name $time_out | tee -a $log_file + $script_dir/advanced.size.time.sh $file_name $time_out | tee -a $log_file + echo "$graph_size" >> $log_file + echo "$graph_name" >> $log_file + done +done + +python tablegen.py diff --git a/experiments/erdos-biogrid/footer.erdos-biogrid b/experiments/erdos-biogrid/footer.erdos-biogrid deleted file mode 100644 index 13380de..0000000 --- a/experiments/erdos-biogrid/footer.erdos-biogrid +++ /dev/null @@ -1,4 +0,0 @@ -\hline -\end{tabular} -\end{center} -\end{table} diff --git a/experiments/erdos-biogrid/header.erdos-biogrid b/experiments/erdos-biogrid/header.erdos-biogrid deleted file mode 100644 index 745280f..0000000 --- a/experiments/erdos-biogrid/header.erdos-biogrid +++ /dev/null @@ -1,11 +0,0 @@ -\begin{table}[!tbh] -\caption{We give the kernel size $k$ and running time $t$ for each reduction technique on Erd\H{o}s and BioGRID graphs. We further give the number of vertices $n$ and edges $m$ for each graph.} -\label{table:kernel-erdos-biogrid} -\scriptsize -\setlength{\tabcolsep}{.7ex} -\begin{center} -\begin{tabular}[tb]{lrr@{\hskip 7pt} rr@{\hskip 7pt} rr@{\hskip 7pt} rr@{\hskip 7pt} rr} -\toprule -\multicolumn{3}{c}{Graph} & \multicolumn{2}{c}{\critical}& \multicolumn{2}{c}{\maxcritical} & \multicolumn{2}{c}{\advanced}&\multicolumn{2}{c}{\simple} \\ -\multicolumn{1}{l}{Name} & \multicolumn{1}{c}{$n$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} \\ -\cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(r){3-3}\cmidrule(r){4-4}\cmidrule(r){5-5}\cmidrule(r){6-6}\cmidrule(r){7-7}\cmidrule(r){8-8}\cmidrule(r){9-9}\cmidrule{10-10}\cmidrule{11-11} \\[2pt] diff --git a/experiments/erdos-biogrid/mk_erdos_biogrid_table_data.py b/experiments/erdos-biogrid/mk_erdos_biogrid_table_data.py deleted file mode 100644 index 0603001..0000000 --- a/experiments/erdos-biogrid/mk_erdos_biogrid_table_data.py +++ /dev/null @@ -1,115 +0,0 @@ -#! /usr/bin/python - -import sys -import re - -def read_in_columns(file_name, rows): - critical_kernel_file = open(file_name, 'r') - - first_file=(len(rows)==0) - - index=0 - for line in critical_kernel_file: - if first_file != 1 and index >= len(rows): - print "ERROR! Received too many rows from " + file_name - sys.exit(1) - - if first_file: - rows.append(line.strip().split()) - else: - rows[index].extend(line.strip().split()) - - index = index + 1 - - if index == 0 and "advanced" in file_name: - while index < len(rows): - rows[index].append("Missing") - rows[index].append("Missing") - index = index + 1 - - if index != len(rows): - print "ERROR! Received too few rows from " + file_name - sys.exit(1) - - -def format_numbers(rows): - for row in rows: - - min_time = sys.maxint - min_kernel = float('inf') - - for index in range(0,len(row)): - if row[index] == '-' or row[index] == 'Missing': - continue - - if index in [3,5,7,9]: - if int(row[index]) < min_kernel: - min_kernel = int(row[index]) - - if int(row[index]) == min_kernel and float(row[index+1]) < min_time: - min_time = float(row[index+1]) - - - for index in range(0,len(row)): - - if row[index] == '-' or row[index] == 'Missing': - continue - - if index in [3,5,7,9]: - make_kernel_bold = (int(row[index]) == min_kernel) - make_time_bold = (make_kernel_bold and (abs(float(row[index+1]) - min_time) < 0.001)) - - row[index] = '\\numprint{' + row[index] + '}' - row[index+1] = '\\numprint{' + row[index+1] + '}' - - if make_kernel_bold == 1: - row[index] = '\\textbf{' + row[index] + '}' - - if make_time_bold == 1: - row[index+1] = '\\textbf{' + row[index+1] + '}' - elif index < 3 and index > 0: - row[index] = '\\numprint{' + row[index] + '}' - - - -def read_and_format_rows(data_set_name, rows): - read_in_columns(data_set_name + '.name', rows) - read_in_columns(data_set_name + '.graph.size', rows) - read_in_columns(data_set_name + '.critical.size', rows) - read_in_columns(data_set_name + '.maxcritical.size', rows) - read_in_columns(data_set_name + '.advanced.size', rows) - read_in_columns(data_set_name + '.simple.size', rows) - format_numbers(rows) - - - -def print_rows(data_set_name, rows, last): - pattern = re.compile('.*\{(.*\d)\}') - - if len(rows) > 0: - num_columns = len(rows[0]) - sys.stdout.write("\\multicolumn{" + str(num_columns) + "}{l}{\\bf{" + data_set_name + "}} \\\\[2pt]") - for row in rows: - print "" - m = pattern.match(row[1]) - if m and int(m.group(1)) < 100: - continue - sys.stdout.write("&".join(row) + " \\\\") - if last == 1 or len(rows) == 0: - print "" - else: - print "[8pt]" - - -# read data sets into the rows -erdos_rows = [] -biogrid_rows = [] - -read_and_format_rows('erdos' , erdos_rows) -read_and_format_rows('biogrid', biogrid_rows) - -print_rows("Erd\\H{o}s Graphs", erdos_rows, 0) -print_rows("BioGRID Graphs" , biogrid_rows, 1) - -#print rows - diff --git a/experiments/erdos-biogrid/tablegen.py b/experiments/erdos-biogrid/tablegen.py new file mode 100644 index 0000000..3e4aa15 --- /dev/null +++ b/experiments/erdos-biogrid/tablegen.py @@ -0,0 +1,32 @@ +#! /usr/bin/python + +from table_gen import * + +same_keys_list = [] +different_keys_list = [] +keys_list = ["graph-name"] +#[data, type, operation, formating] +columns_list = [("vertices", "int"), ("edges", "int"), ("critical-set-k", "int"), ("critical-set-time", "float"), ("maxcritical-set-k", "int"), ("maxcritical-set-time", "float"), ("simple-set-k", "int"), ("simple-set-time", "float")] +title = "Results of Erdos and BioGRID Experiments" +author = "Darren Strash, Daniel Gathogo (automated)" +column_heads = [("Graph", 3), ("Critical", 2), ("Maxcritical", 2), ("Simple", 2)] +#column_heads = [] #empty for non publication table +column_names = ["Name", "n", "m", "k", "t", "k", "t", "k", "t"] #start with names for each key in keys_list + +compare_cols = ["min", 4, 6] #highlight max or min, zero-indexed count in column_names +experiment_name = "Erdos-BioGRID" +experiments = ["erdos", "biogrid"] +sub_headers = ["Erdos Graphs", "BioGRID Graphs"] +table_format = "latex" #latex, latex_publication, markdown +caption = "We give the kernel size k and running time t for each reduction technique on synthetically- generated Sanchis data sets. We also list the data used to generate the graphs: the number of vertices n, number of edges m, and independence number q(G)." + +table = table_writer() +table.initialize(experiment_name, table_format, title, author) #packages-optional last argument +for i in range(len(experiments)): + temp_dir = experiments[i] + '/' + exp = data_cruncher() + exp.process_dir(temp_dir, keys_list) + exp.validate_data(same_keys_list, different_keys_list) + table.add_experiment(exp, experiments[i], sub_headers[i]) #sub_headers optional + +table.write_table(column_names, column_heads, columns_list, compare_cols, caption) diff --git a/experiments/erdos-biogrid/temp_file b/experiments/erdos-biogrid/temp_file deleted file mode 100644 index c6a4748..0000000 --- a/experiments/erdos-biogrid/temp_file +++ /dev/null @@ -1 +0,0 @@ -Homo-sapiens-3.3.122 19592 169285 [0.15s] 150 3 131 diff --git a/experiments/large-networks/experiment.large-networks.sh b/experiments/large-networks/experiment.large-networks.sh index 136ba7d..42ae726 100755 --- a/experiments/large-networks/experiment.large-networks.sh +++ b/experiments/large-networks/experiment.large-networks.sh @@ -3,36 +3,35 @@ time_out=3600 experiment_name=large-networks -output_dir=$experiment_name.$time_out data_dir=../../data/ script_dir=../../scripts/ -rm -rf old.$output_dir -mv $output_dir old.$output_dir -mkdir $output_dir - -data_sets="konect snap law" - -for data_set in $data_sets -do - echo "Evaluating data set $data_set..." - -$script_dir/graph.name.sh $data_dir/$data_set | tee $output_dir/$data_set.graph.name -$script_dir/graph.size.sh $data_dir/$data_set | tee $output_dir/$data_set.graph.size -#./critical.size.sh $data_dir/$data_set $time_out | tee $output_dir/$data_set.critical.size -#./maxcritical.size.sh $data_dir/$data_set $time_out | tee $output_dir/$data_set.maxcritical.size -$script_dir/simple.size.sh $data_dir/$data_set $time_out | tee $output_dir/$data_set.simple.size -$script_dir/simple.solution.sh $data_dir/$data_set $time_out | tee $output_dir/$data_set.simple.solution -$script_dir/advanced.size.sh $data_dir/$data_set $time_out | tee $output_dir/$data_set.advanced.size -$script_dir/advanced.solution.sh $data_dir/$data_set $time_out| tee $output_dir/$data_set.advanced.solution - +data_sets="snap konect law" + +for item in $data_sets; do + echo "Evaluating data set $item..." + output_dir=$item + rm -rf old.$output_dir + mv $output_dir old.$output_dir + mkdir $output_dir + data_set=$data_dir/$item + + for file_name in `ls -1 $data_set/*.graph`; do + temp=${file_name##*/} + temp=${temp%.*} + graph_name=$($script_dir/graph.name.sh $file_name) + graph_size=$($script_dir/graph.size.sh $file_name) + log_file=$output_dir/log.$temp + + #./critical.size.sh $data_dir/$item $time_out | tee $output_dir/$item.critical.size + #./maxcritical.size.sh $data_dir/$item $time_out | tee $output_dir/$item.maxcritical.size + $script_dir/simple.size.sh $file_name $time_out | tee -a $log_file + $script_dir/simple.solution.sh $file_name $time_out | tee -a $log_file + $script_dir/advanced.size.sh $file_name $time_out | tee -a $log_file + $script_dir/advanced.solution.sh $file_name $time_out | tee -a $log_file + echo "$graph_size" >> $log_file + echo "$graph_name" >> $log_file + done done -cp header.$experiment_name $output_dir/ -cp footer.$experiment_name $output_dir/ - -cp mk_large_networks_table_data.py $output_dir/ -cd $output_dir -cat header.$experiment_name > $experiment_name.table.tex -python mk_large_networks_table_data.py >> $experiment_name.table.tex -cat footer.$experiment_name >> $experiment_name.table.tex +python tablegen.py diff --git a/experiments/large-networks/footer.large-networks b/experiments/large-networks/footer.large-networks deleted file mode 100644 index a5ee32c..0000000 --- a/experiments/large-networks/footer.large-networks +++ /dev/null @@ -1,5 +0,0 @@ -\hline -\end{tabular} -\end{center} -\label{table:solution-large-networks} -\end{table} diff --git a/experiments/large-networks/header.large-networks b/experiments/large-networks/header.large-networks deleted file mode 100644 index 032b5d3..0000000 --- a/experiments/large-networks/header.large-networks +++ /dev/null @@ -1,10 +0,0 @@ -\begin{table} -\caption{We give the size $k_{\max}$ of largest connected component in the kernel from each reduction technique and the running time $t$ of each algorithm to compute an exact maximum independent set. We further give the number of vertices $n$ and edges $m$ for each graph.} -\scriptsize -\setlength{\tabcolsep}{.7ex} -\begin{center} -\begin{tabular}[tb]{lrr@{\hskip 13pt} rr@{\hskip 13pt} rr} -\toprule -\multicolumn{3}{c}{Graph} & \multicolumn{2}{c}{\ai} &\multicolumn{2}{c}{\simple+\mcs}\\ -\multicolumn{1}{l}{Name} & \multicolumn{1}{c}{$n$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}{$k_{\max}$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k_{\max}$} & \multicolumn{1}{c}{$t$} \\ -\cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(r){3-3}\cmidrule(r){4-4}\cmidrule(r){5-5}\cmidrule(r){6-6}\cmidrule(r){7-7} \\[2pt] diff --git a/experiments/large-networks/mk_large_networks_table_data.py b/experiments/large-networks/mk_large_networks_table_data.py deleted file mode 100644 index 3192a38..0000000 --- a/experiments/large-networks/mk_large_networks_table_data.py +++ /dev/null @@ -1,117 +0,0 @@ -#! /usr/bin/python - -import sys -import re - -def read_in_columns(file_name, rows): - critical_kernel_file = open(file_name, 'r') - - first_file=(len(rows)==0) - - index=0 - for line in critical_kernel_file: - if first_file != 1 and index >= len(rows): - print "ERROR! Received too many rows from " + file_name - sys.exit(1) - - if first_file: - rows.append(line.strip().split()) - else: - rows[index].extend(line.strip().split()) - - index = index + 1 - - if index == 0 and "advanced" in file_name: - while index < len(rows): - rows[index].append("Missing") - index = index + 1 - - if index != len(rows): - print "ERROR! Received too few rows from " + file_name - sys.exit(1) - - -def format_numbers(rows): - for row in rows: - - min_time = sys.maxint - min_kernel = float('inf') - for index in range(0,len(row)): - if row[index] == '-' or row[index] == 'Missing': - continue - - #print "\"" + row[index] + "\"" - if index in [3,5,7,9]: - if int(row[index]) < min_kernel: - min_kernel = int(row[index]) - - if index in [4,6,8,10]: - if float(row[index]) < min_time: - min_time = float(row[index]) - - for index in range(0,len(row)): - make_bold=0 - - if row[index] == '-' or row[index] == 'Missing': - continue - - if index in [3,5]: - make_bold=(int(row[index]) == min_kernel) - - if index in [4,6]: - make_bold=(abs(float(row[index]) - min_time) < 0.001) - - if index != 0: - row[index] = '\\numprint{' + row[index] + '}' - - if make_bold == 1: - row[index] = '\\textbf{' + row[index] + '}' - - - -def read_and_format_rows(data_set_name, rows): - read_in_columns(data_set_name + '.graph.name', rows) - read_in_columns(data_set_name + '.graph.size', rows) -# read_in_columns(data_set_name + '.critical.size', rows) -# read_in_columns(data_set_name + '.maxcritical.size', rows) - read_in_columns(data_set_name + '.advanced.size', rows) - read_in_columns(data_set_name + '.advanced.solution',rows) - read_in_columns(data_set_name + '.simple.size', rows) - read_in_columns(data_set_name + '.simple.solution', rows) - format_numbers(rows) - - - -def print_rows(data_set_name, rows, last): - pattern = re.compile('.*\{(.*\d)\}') - - num_columns = 7 - if len(rows) > 0: - num_columns = len(rows[0]) - sys.stdout.write("\\multicolumn{" + str(num_columns) + "}{l}{\\bf{" + data_set_name + "}} \\\\[2pt]") - for row in rows: - print "" - m = pattern.match(row[1]) - if m and int(m.group(1)) < 100: - continue - sys.stdout.write("&".join(row) + " \\\\") - if last == 1 or len(rows) == 0: - print "" - else: - print "[8pt]" - -# read data sets into the rows -law_rows = [] -snap_rows = [] -konect_rows = [] - -read_and_format_rows('law' , law_rows) -read_and_format_rows('snap' , snap_rows) -read_and_format_rows('konect', konect_rows) - -print_rows("LAW Graphs" , law_rows , 0) -print_rows("SNAP Graphs" , snap_rows , 0) -print_rows("KONECT Graphs", konect_rows, 1) - -#print rows - diff --git a/experiments/large-networks/tablegen.py b/experiments/large-networks/tablegen.py new file mode 100644 index 0000000..08be530 --- /dev/null +++ b/experiments/large-networks/tablegen.py @@ -0,0 +1,31 @@ +#! /usr/bin/python + +from table_gen import * + +same_keys_list = [] +different_keys_list = [] +keys_list = ["graph-name"] +#[data, type, operation, formating] +columns_list = [("vertices", "int"), ("edges", "int"), ("simple-set-k", "int"), ("simple-solution", "float")] +title = "Results of Large Networks Experiments" +author = "Darren Strash, Daniel Gathogo (automated)" +column_heads = [("Graph", 3), ("Simple+MCS", 2)] +#column_heads = [] #empty for non publication table +column_names = ["Name", "n", "m", "k", "t"] #start with names for each key in keys_list + +compare_cols = [] #highlight max or min, zero-indexed count in column_names +experiment_name = "Large-Networks" +experiments = ["law", "snap", "konect"] +sub_headers = ["LAW Graphs", "SNAP Graphs", "KONECT Graphs"] +table_format = "latex_publication" #latex, latex_publication, markdown +caption = "We give the size kmax of largest connected component in the kernel from each reduction technique and the running time t of each algorithm to compute an exact maximum independent set. We further give the number of vertices n and edges m for each graph." + +table = table_writer() +table.initialize(experiment_name, table_format, title, author) #packages-optional last argument +for i in range(len(experiments)): + temp_dir = experiments[i] + '/' + exp = data_cruncher() + exp.process_dir(temp_dir, keys_list) + exp.validate_data(same_keys_list, different_keys_list) + table.add_experiment(exp, experiments[i], sub_headers[i]) #sub_headers optional +table.write_table(column_names, column_heads, columns_list, compare_cols, caption) diff --git a/experiments/large-networks/temp_file b/experiments/large-networks/temp_file deleted file mode 100644 index c749f98..0000000 --- a/experiments/large-networks/temp_file +++ /dev/null @@ -1 +0,0 @@ -dblp-2010 326186 807700 [0.65s] 0 0 0 159952 diff --git a/experiments/sanchis/experiment.sanchis.sh b/experiments/sanchis/experiment.sanchis.sh index 72973bf..3448091 100755 --- a/experiments/sanchis/experiment.sanchis.sh +++ b/experiments/sanchis/experiment.sanchis.sh @@ -1,10 +1,12 @@ #! /bin/bash time_out=3600 +seeds=5 +seeds_minus_one=$((seeds - 1)) -output_dir=sanchis.$time_out +output_dir=sanchis -data_dir=../../data/ +data_dir=../../data script_dir=../../scripts/ sanchis_data_set=$data_dir/sanchis @@ -12,19 +14,20 @@ rm -rf old.$output_dir mv $output_dir old.$output_dir mkdir $output_dir - -$script_dir/graph.size.sh $sanchis_data_set | tee $output_dir/sanchis.graph.size -./sanchis.independence.size.sh $sanchis_data_set | tee $output_dir/sanchis.independence.size -$script_dir/critical.size.sh $sanchis_data_set $time_out | tee $output_dir/sanchis.critical.size -$script_dir/maxcritical.size.sh $sanchis_data_set $time_out | tee $output_dir/sanchis.maxcritical.size -$script_dir/simple.size.time.sh $sanchis_data_set $time_out | tee $output_dir/sanchis.simple.size -$script_dir/advanced.size.time.sh $sanchis_data_set $time_out | tee $output_dir/sanchis.advanced.size - -cp header.sanchis $output_dir/ -cp footer.sanchis $output_dir/ -cp mk_sanchis_table_data.py $output_dir/ - -cd $output_dir -cat header.sanchis > sanchis.table.tex -python mk_sanchis_table_data.py >> sanchis.table.tex -cat footer.sanchis >> sanchis.table.tex +for file_name in `ls -1 $sanchis_data_set/*.graph`; do + temp=${file_name##*/} + temp=${temp%.*} + graph_size=$($script_dir/graph.size.sh $file_name) + independence_size=$(./sanchis.independence.size.sh $file_name) + + for seed in $(seq 0 $seeds_minus_one); do + log_file=$output_dir/log.$temp.$seed + $script_dir/critical.size.sh $file_name $time_out | tee -a $log_file + $script_dir/maxcritical.size.sh $file_name $time_out | tee -a $log_file + $script_dir/simple.size.time.sh $file_name $time_out | tee -a $log_file + echo "$graph_size" >> $log_file + echo "$independence_size" >> $log_file + done +done + +python tablegen.py diff --git a/experiments/sanchis/footer.sanchis b/experiments/sanchis/footer.sanchis deleted file mode 100644 index 00576ea..0000000 --- a/experiments/sanchis/footer.sanchis +++ /dev/null @@ -1,5 +0,0 @@ -\hline -\end{tabular} -\end{center} -\label{table:kernel-sanchis} -\end{table} diff --git a/experiments/sanchis/header.sanchis b/experiments/sanchis/header.sanchis deleted file mode 100644 index 4f47c87..0000000 --- a/experiments/sanchis/header.sanchis +++ /dev/null @@ -1,10 +0,0 @@ -\begin{table} -\caption{We give the kernel size $k$ and running time $t$ for each reduction technique on synthetically-generated Sanchis data sets. We also list the data used to generate the graphs: the number of vertices $n$, number of edges $m$, and independence number $\alpha(G)$.} -\scriptsize -\setlength{\tabcolsep}{.7ex} -\begin{center} -\begin{tabular}[tb]{rrr@{\hskip 13pt} rr@{\hskip 13pt} rr@{\hskip 13pt} rr@{\hskip 13pt} rr} -\toprule -\multicolumn{3}{c}{Graph} & \multicolumn{2}{c}{\critical}& \multicolumn{2}{c}{\maxcritical}& \multicolumn{2}{c}{\advanced}&\multicolumn{2}{c}{\simple} \\ -\multicolumn{1}{c}{$n$} & \multicolumn{1}{c}{$m$} & \multicolumn{1}{c}{$\alpha(G)$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} & \multicolumn{1}{c}{$k$} & \multicolumn{1}{c}{$t$} \\ -\cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(r){3-3}\cmidrule(r){4-4}\cmidrule(r){5-5}\cmidrule(r){6-6}\cmidrule(r){7-7}\cmidrule(r){8-8}\cmidrule(r){9-9}\cmidrule(r){10-10}\cmidrule{11-11} diff --git a/experiments/sanchis/mk_sanchis_table_data.py b/experiments/sanchis/mk_sanchis_table_data.py deleted file mode 100644 index 9fcac59..0000000 --- a/experiments/sanchis/mk_sanchis_table_data.py +++ /dev/null @@ -1,81 +0,0 @@ -#! /usr/bin/python - -import sys - -def read_in_columns(file_name, rows): - sanchis_file = open(file_name, 'r') - - first_file=(len(rows)==0) - - index=0 - for line in sanchis_file: - if first_file != 1 and index >= len(rows): - print "ERROR! Received too many rows from " + file_name - sys.exit(1) - - if first_file: - rows.append(line.strip().split()) - else: - rows[index].extend(line.strip().split()) - - index = index + 1 - - if index == 0 and "advanced" in file_name: - while index < len(rows): - rows[index].append("Missing") - rows[index].append("Missing") - index = index + 1 - - if index != len(rows): - print "ERROR! Received too few rows from " + file_name - sys.exit(1) - - -rows = [] -read_in_columns('sanchis.graph.size', rows) -read_in_columns('sanchis.independence.size', rows) -read_in_columns('sanchis.critical.size', rows) -read_in_columns('sanchis.maxcritical.size', rows) -read_in_columns('sanchis.advanced.size', rows) -read_in_columns('sanchis.simple.size', rows) - - -for row in rows: - - min_time = sys.maxint - min_kernel = float('inf') - - for index in range(0,len(row)): - if row[index] == '-' or row[index] == "Missing": - continue - - if index in [3,5,7,9]: - if int(row[index]) < min_kernel: - min_kernel = int(row[index]) - - if int(row[index]) == min_kernel and float(row[index+1]) < min_time: - min_time = float(row[index+1]) - - for index in range(0,len(row)): - if row[index] == '-' or row[index] == "Missing": - continue - - if index in [3,5,7,9]: - make_kernel_bold = (int(row[index]) == min_kernel) - make_time_bold = (make_kernel_bold and (abs(float(row[index+1]) - min_time) < 0.001)) - row[index] = '\\numprint{' + row[index] + '}' - row[index+1] = '\\numprint{' + row[index+1] + '}' - - if make_kernel_bold==1: - row[index] = '\\textbf{' + row[index] + '}' - if make_time_bold==1: - row[index+1] = '\\textbf{' + row[index+1] + '}' - - elif index < 3: - row[index] = '\\numprint{' + row[index] + '}' - -for row in rows: - print "&".join(row), "\\\\" - -#print rows - diff --git a/experiments/sanchis/sanchis.independence.size.sh b/experiments/sanchis/sanchis.independence.size.sh index 057f302..aa85ece 100755 --- a/experiments/sanchis/sanchis.independence.size.sh +++ b/experiments/sanchis/sanchis.independence.size.sh @@ -1,9 +1,5 @@ #! /bin/bash -directory_name=$1 - -for i in `ls -1 $directory_name/*.graph`; do - - echo $i | sed -e "s#.*/##g" | sed -e 's#sanchis-[0-9]*-\([0-9]*\).graph#\1#g' - -done +experiment_name=$1 +echo -n "independence_number : " +echo $experiment_name | sed -e "s#.*/##g" | sed -e 's#sanchis-[0-9]*-\([0-9]*\).graph#\1#g' diff --git a/experiments/sanchis/tablegen.py b/experiments/sanchis/tablegen.py new file mode 100755 index 0000000..4a7e668 --- /dev/null +++ b/experiments/sanchis/tablegen.py @@ -0,0 +1,32 @@ +#! /usr/bin/python + +from table_gen import * + +same_keys_list = [] +different_keys_list = [] +keys_list = ["vertices", "edges", "independence_number"] +#[data, type, operation, formating] +columns_list = [("critical-set-k", "int"), ("critical-set-time", "float"), ("critical-set-time", "float", "average"), ("maxcritical-set-k", "int"), ("maxcritical-set-time", "float"), ("maxcritical-set-time", "float", "average"), ("simple-set-k", "int"), ("simple-set-time", "float"), ("simple-set-time","float", "average")] +title = "Results of Sanchis Experiments" +author = "Darren Strash, Daniel Gathogo (automated)" +column_heads = [("Graph", 3), ("Critical", 3), ("Maxcritical", 3), ("Simple", 3)] +#column_heads = [] #empty for non publication table +column_names = ["n", "m", "q(G)", "k", "t","t-avg", "k", "t","t-avg", "k", "t", "t-avg"] #start with names for each key in keys_list + +compare_cols = ["min", 3, 6, 9] #highlight max or min, zero-indexed count in column_names +experiment_name = "Sanchis" +experiments = ["sanchis"] +sub_headers = [] #subheadings for each experiment +table_format = "latex" #latex, latex_publication, markdown +caption = "We give the kernel size k and running time t for each reduction technique on synthetically- generated Sanchis data sets. We also list the data used to generate the graphs: the number of vertices n, number of edges m, and independence number q(G)." + +table = table_writer() +table.initialize(experiment_name, table_format, title, author) #packages-optional last argument +for i in range(len(experiments)): + temp_dir = experiments[i]+ "/" + exp = data_cruncher() + exp.process_dir(temp_dir, keys_list) + exp.validate_data(same_keys_list, different_keys_list) + table.add_experiment(exp, experiments[i]) #sub_headers[i] optional + +table.write_table(column_names, column_heads, columns_list, compare_cols, caption) diff --git a/experiments/sanchis/temp_file b/experiments/sanchis/temp_file deleted file mode 100644 index 02f8c54..0000000 --- a/experiments/sanchis/temp_file +++ /dev/null @@ -1 +0,0 @@ -sanchis-09000-5899 9000 451349 [0.50s] 0 0 0 diff --git a/scripts/advanced.size.sh b/scripts/advanced.size.sh index b5abc20..03651a7 100755 --- a/scripts/advanced.size.sh +++ b/scripts/advanced.size.sh @@ -4,15 +4,13 @@ directory_name=$1 time_out=$2 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.snap`; do +#works on .snap +/home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/component/bin Main $i& - /home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/component/bin Main $i& - - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "-" - else - cat temp_file | awk '{print $7}' - fi -done +#kill after timeout +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "-" +else + cat temp_file | awk '{print "advanced-set-k : "$7}' +fi diff --git a/scripts/advanced.size.time.sh b/scripts/advanced.size.time.sh index 4c4b136..b5d413a 100755 --- a/scripts/advanced.size.time.sh +++ b/scripts/advanced.size.time.sh @@ -1,16 +1,16 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.snap`; do +#works on .snap +/home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/kernelize/bin Main $experiment_name& - /home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/kernelize/bin Main $i& - - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "- -" - fi -done +#kill after timeout +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "- -" +else + echo 'Missing' >> temp_file +fi diff --git a/scripts/advanced.solution.sh b/scripts/advanced.solution.sh index 31e0e88..8240833 100755 --- a/scripts/advanced.solution.sh +++ b/scripts/advanced.solution.sh @@ -1,18 +1,16 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.snap`; do +#works on .snap +/home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/bin Main $experiment_name > temp_file& - /home/strash/java/jdk1.8.0_60/bin/java -cp /global_data/strash/reduction-exact-mis-experiments/branch-and-reduce/bin Main $i > temp_file& - - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "-" - else - cat temp_file | awk '{print $4}' - fi -done +#kill after timeout +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "-" +else + cat temp_file | awk '{print "advanced-set-solution : "$4}' +fi diff --git a/scripts/critical.size.sh b/scripts/critical.size.sh index e95060e..f948b80 100755 --- a/scripts/critical.size.sh +++ b/scripts/critical.size.sh @@ -1,19 +1,16 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 binary_dir=../../bin script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.graph`; do +$binary_dir/kernel-mis --experiment=kernel-size-critical-set --input-file=$experiment_name --table > temp_file& - $binary_dir/kernel-mis --experiment=kernel-size-critical-set --input-file=$i --table > temp_file& - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "- -" - else - cat temp_file | awk '{print $6 " " $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" - fi -done +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "- -" +else + cat temp_file | awk '{print "critical-set-k : "$6 "\n" "critical-set-time : " $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" +fi diff --git a/scripts/graph.name.sh b/scripts/graph.name.sh index 4861b2b..2f451dd 100755 --- a/scripts/graph.name.sh +++ b/scripts/graph.name.sh @@ -1,9 +1,6 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 -for i in `ls -1 $directory_name/*.graph`; do - - echo $i | sed -e "s#.*/##g" | sed -e "s#\.edges##g" | sed -e "s#\.graph##g" | sed -e "s#\.snap##g" | sed -e "s#-3\.3\.122##g" | sed -e "s#-uniq##g" | sed -e "s#zhishi-##g" | sed -e "s#-friendships##g" | sed -e "s#-relationships##g" | sed -e "s#Immunodeficiency-Virus#HIV#g" - -done +echo -n "graph-name : " +echo $experiment_name | sed -e "s#.*/##g" | sed -e "s#\.edges##g" | sed -e "s#\.graph##g" | sed -e "s#\.snap##g" | sed -e "s#-3\.3\.122##g" | sed -e "s#-uniq##g" | sed -e "s#zhishi-##g" | sed -e "s#-friendships##g" | sed -e "s#-relationships##g" | sed -e "s#Immunodeficiency-Virus#HIV#g" diff --git a/scripts/graph.size.sh b/scripts/graph.size.sh index 921b9c2..03b15e3 100755 --- a/scripts/graph.size.sh +++ b/scripts/graph.size.sh @@ -1,10 +1,6 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 binary_dir=../../bin -for i in `ls -1 $directory_name/*.graph`; do - - head -1 $i | awk '{print $1 " " $2}' - -done +head -1 $experiment_name | awk '{print "vertices : " $1 "\n" "edges : " $2}' diff --git a/scripts/maxcritical.size.sh b/scripts/maxcritical.size.sh index 55f4148..4be6ebc 100755 --- a/scripts/maxcritical.size.sh +++ b/scripts/maxcritical.size.sh @@ -1,19 +1,18 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 binary_dir=../../bin script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.graph`; do - $binary_dir/kernel-mis --experiment=kernel-size-maximum-critical-set --input-file=$i --table > temp_file& - +$binary_dir/kernel-mis --experiment=kernel-size-maximum-critical-set --input-file=$experiment_name --table > temp_file& + #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "- -" - else - cat temp_file | awk '{print $6 " " $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" - fi -done +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "- -" +else + cat temp_file | awk '{print "maxcritical-set-k : "$6 "\n" "maxcritical-set-time : "$4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" + +fi diff --git a/scripts/simple.size.sh b/scripts/simple.size.sh index 6ba8bb3..8a8d709 100755 --- a/scripts/simple.size.sh +++ b/scripts/simple.size.sh @@ -1,19 +1,17 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 binary_dir=../../bin script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.graph`; do - $binary_dir/kernel-mis --experiment=kernel-size-simple --input-file=$i --table > temp_file& - +$binary_dir/kernel-mis --experiment=kernel-size-simple --input-file=$experiment_name --table > temp_file& + #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "- -" - else - cat temp_file | awk '{print $5}' | sed -e "s#\[##g" | sed -e "s#s\]##g" - fi -done +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "- -" +else + cat temp_file | awk '{print "simple-set-k : " $5}' | sed -e "s#\[##g" | sed -e "s#s\]##g" +fi diff --git a/scripts/simple.size.time.sh b/scripts/simple.size.time.sh index a133ac9..093840b 100755 --- a/scripts/simple.size.time.sh +++ b/scripts/simple.size.time.sh @@ -1,19 +1,16 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 binary_dir=../../bin script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.graph`; do +$binary_dir/kernel-mis --experiment=kernel-size-simple --input-file=$experiment_name --table > temp_file& - $binary_dir/kernel-mis --experiment=kernel-size-simple --input-file=$i --table > temp_file& - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then - echo "- -" - else - cat temp_file | awk '{print $5 " " $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" - fi -done +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then + echo "- -" +else + cat temp_file | awk '{print "simple-set-k : "$5 "\n" "simple-set-time : " $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" +fi diff --git a/scripts/simple.solution.sh b/scripts/simple.solution.sh index e5abb2b..08df0de 100755 --- a/scripts/simple.solution.sh +++ b/scripts/simple.solution.sh @@ -1,29 +1,26 @@ #! /bin/bash -directory_name=$1 +experiment_name=$1 time_out=$2 binary_dir=../../bin script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -for i in `ls -1 $directory_name/*.graph`; do +$binary_dir/kernel-mis --experiment=simple-mcs --input-file=$experiment_name --table > temp_file& - $binary_dir/kernel-mis --experiment=simple-mcs --input-file=$i --table > temp_file& - - #kill after timeout - $script_dir/kill_timer.sh $! $time_out - if [ $? -eq 0 ]; then +#kill after timeout +$script_dir/kill_timer.sh $! $time_out +if [ $? -eq 0 ]; then # echo "Killed successfully..." 1>&2 # echo -n "$i " - echo "-" - else + echo "-" +else # echo -n "$i " - grep "ERROR" temp_file 1>&2 - if [ $? -eq 1 ] && [ `cat temp_file | wc -w` != "0" ]; then - cat temp_file | awk '{print $4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" - else - cat temp_file 1>&2 + grep "ERROR" temp_file 1>&2 + if [ $? -eq 1 ] && [ `cat temp_file | wc -w` != "0" ]; then + cat temp_file | awk '{print "simple-solution : "$4}' | sed -e "s#\[##g" | sed -e "s#s\]##g" + else + cat temp_file 1>&2 # echo "Found ERROR!" 1>&2 - echo "-" - fi - fi -done + echo "-" + fi +fi