Skip to content

Instantly share code, notes, and snippets.

@guicho271828
Created February 19, 2015 18:58
Show Gist options
  • Save guicho271828/88d5e1ee6b869f917c6d to your computer and use it in GitHub Desktop.
Save guicho271828/88d5e1ee6b869f917c6d to your computer and use it in GitHub Desktop.
figure for ICAPS15
(defun %length-distribution (&optional used)
(let ((path
(merge-pathnames
(format nil "output/~(~{~a-~}dist~@[-used~]~).pdf"
*set-dirs* used)))
(*solver-blacklist* '(fffd fffdtl mv2 mv2tl)))
(includegraphics (namestring path))
(let ((hist (associative-array 2)))
(dolist (s (solvers))
(dolist (d (domains))
(dolist (p (problems))
(let ((lengths (match (aaref *db* d p s :macro-length)
((list lengths used-lengths)
(if used used-lengths lengths)))))
(dolist (l lengths)
(setf (aaref hist d l)
(if (aaref hist d l)
(1+ (aaref hist d l))
1)))))))
(with-plots (s :debug t)
(gp-setup :terminal (if used
'(:pdf :monochrome :enhanced :size |1.15,1.35|)
'(:pdf :monochrome :enhanced :size |2.1,1.35|))
:xlabel (if used "Macro Length (Used)" "Macro Length")
:xlabel '(:offset |0,1| :font "Times New Roman, 11")
:ylabel (if used "" "# Occurences")
:ylabel '(:offset |1.5,0| :font "Times New Roman, 11")
:y2label (if used "# Occurences" "")
:y2label '(:offset |-0.5,0| :font "Times New Roman, 11")
:xtics '(:offset |0,0.5| :font "Times New Roman, 11")
:ytics '(:offset |0.5,0| :font "Times New Roman, 11")
:xrange (if used :|[1:100]| :|[1:200]|)
:yrange :|[1:10000]|
:logscale :xy
:format '(:x "10^%T")
:format `(:y ,(if used "" "10^%T"))
:output path
:bmargin :2mm
:rmargin (if used :1.5mm :10.5mm)
:lmargin (if used :1mm :4mm)
:tmargin :0.4mm
:key '(:at :screen |1.02,1|
:font "Times New Roman, 11"
:samplen 0.3
:spacing 0.8
:horizontal
:maxrows 20
:maxcols 1)
:pointsize "0.4px")
(when used
(format s "~&unset key~&")
(format s "~&unset ylabel~&"))
(iter (for d in (domains))
(for pt from 1)
(plot (let ((d d))
(lambda ()
(dolist (l (associative-array-dimension hist 1))
(when-let ((h (aaref hist d l)))
(format s "~&~a ~a" l h)))))
:using '(1 2)
:title (first (split "-" (princ-to-string d)))
:with `(:points)
#+nil `(:points :linestyle ,pt)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment