@@ -74,7 +74,7 @@ def collect_instances(shared_data: Optional[str], benchmarks_location: str):
7474 "--param" ,
7575 "-p" ,
7676 help = "Additional solution parameters to add to each row of the CSV file" ,
77- default = ["configuration" ],
77+ default = [],
7878 multiple = True ,
7979)
8080@click .argument ("dirs" , nargs = - 1 , type = click .Path (exists = True , dir_okay = True ))
@@ -102,9 +102,12 @@ def collect_objectives_(
102102 count = 0
103103 additional_params = list (additional_params )
104104 with Path (out_file ).open (mode = "w" ) as file :
105+ labels = STANDARD_KEYS .copy ()
106+ labels .remove ("status" ) # No need to output SAT every time
107+ labels = labels + ["run" , "objective" ] + additional_params
105108 writer = csv .DictWriter (
106109 file ,
107- STANDARD_KEYS + [ "run" , "objective" ] + additional_params ,
110+ labels ,
108111 dialect = "unix" ,
109112 extrasaction = "ignore" ,
110113 )
@@ -419,5 +422,66 @@ def compare_configurations(
419422 exit (1 )
420423
421424
425+ @main .command ()
426+ @click .argument (
427+ "objectives" , metavar = "objs_file" , type = click .Path (exists = True , file_okay = True )
428+ )
429+ @click .argument (
430+ "statistics" , metavar = "stats_file" , type = click .Path (exists = True , file_okay = True )
431+ )
432+ @click .argument ("out_file" , type = click .Path (file_okay = True ))
433+ def plot_all_instances (
434+ objectives : str ,
435+ statistics : str ,
436+ out_file : str ,
437+ ):
438+ """Plot all instances in a grid
439+
440+ STATS_FILE is the CSV file containing aggregated statistics data
441+ OBJS_FILE is the CSV file containing aggregated solutions data
442+ OUT_FILE is the file to write the plot to
443+ """
444+ try :
445+ from .analysis .collect import read_csv
446+ from .analysis .plot import plot_all_instances as fn
447+ from bokeh .plotting import save
448+
449+ objs , stats = read_csv (objectives , statistics )
450+ figure = fn (objs , stats )
451+
452+ save (figure , filename = out_file )
453+ except ImportError :
454+ click .echo (IMPORT_ERROR , err = True )
455+ exit (1 )
456+
457+
458+ @main .command ()
459+ @click .argument (
460+ "statistics" , metavar = "stats_file" , type = click .Path (exists = True , file_okay = True )
461+ )
462+ @click .argument ("out_file" , type = click .Path (file_okay = True ))
463+ def plot_cactus (
464+ statistics : str ,
465+ out_file : str ,
466+ ):
467+ """Plots all configurations in a cactus plot of solved instances
468+
469+ STATS_FILE is the CSV file containing aggregated statistics data
470+ OUT_FILE is the file to write the plot to
471+ """
472+ try :
473+ import pandas as pd
474+ from .analysis .plot import plot_cactus as fn
475+
476+ stats = pd .read_csv (statistics )
477+ stats .data_file = stats .data_file .fillna ("" )
478+ fig = fn (stats )
479+ fig .savefig (out_file )
480+
481+ except ImportError :
482+ click .echo (IMPORT_ERROR , err = True )
483+ exit (1 )
484+
485+
422486if __name__ == "__main__" :
423487 main ()
0 commit comments