This directory contains tools for plotting results from constraint optimization experiments.
plotter.py - Main plotting scriptconfig_example.json - Example configuration fileconfig_feasible_fraction.json - Example config for feasible fraction plotsconfig_constraint_violation.json - Example config for constraint violation plotsobjectives.json - Global configuration with optimal objective valuesThe JSON configuration specifies:
plot_type: Type of data to plot (best_candidates, constraint_violation, feasible_fraction)algorithms: List of algorithms with visualization settings
name: Algorithm directory namelabel: Display name in legendcolor: Algorithm color (hex code)linestyle: Line style (-, --, -., :)instances: List of problem instances with colors
name: Instance directory namelabel: Display name in legendcolor: Instance color (hex code)data_path: Path to solutions directoryoutput_dir: Directory for saving plotsplot_settings: Figure settings (size, labels, grid, log scales, etc.)
log_x: Enable logarithmic x-axislog_y: Enable logarithmic y-axisshow_std: Show standard deviation bands (default: true)color_combination: How to combine algorithm and instance colors
"blend": Blend algorithm and instance colors (default)"algorithm": Use only algorithm colors"instance": Use only instance colorsBasic usage:
python3 plotter.py config_example.json
With Guix (recommended):
guix shell python python-matplotlib python-pandas python-numpy -- python3 plotter.py config_example.json
The plotter expects data in this structure:
data_path/
├── algorithm1/
│ ├── instance1/
│ │ ├── best_candidates_*.csv
│ │ ├── constraint_violation/
│ │ │ └── constraint_violations_*.csv
│ │ └── feasible_fraction/
│ │ └── feasible_fractions_*.csv
│ └── instance2/...
└── algorithm2/...
best_candidates plotsconstraint_violation, feasible_fraction)For best_candidates plots, the plotter automatically:
objectives.json(current - optimal) / |optimal| * 100Other plot types use absolute values as normal.