(defun make-histo(file number) (if (equal file "ms") (setf (dist9-min (gethash 'SIZE *dists*)) 3 (dist9-max (gethash 'SIZE *dists*)) 34 (dist9-min (gethash 'CRITICALITY *dists*)) 1.22 (dist9-max (gethash 'CRITICALITY *dists*)) 1.28)) (if (equal file "vh") (setf (dist9-min (gethash 'DYNAMISIM *dists*)) 40 (dist9-max (gethash 'DYNAMISIM *dists*)) 50)) (if (equal file "sh") (setf (dist9-min (gethash 'DYNAMISIM *dists*)) 30 (dist9-max (gethash 'DYNAMISIM *dists*)) 40)) (if (equal file "mi") (setf (dist9-min (gethash 'DYNAMISIM *dists*)) 20 (dist9-max (gethash 'DYNAMISIM *dists*)) 30)) (if (equal file "sl") (setf (dist9-min (gethash 'DYNAMISIM *dists*)) 10 (dist9-max (gethash 'DYNAMISIM *dists*)) 20)) (if (equal file "vl") (setf (dist9-min (gethash 'DYNAMISIM *dists*)) 1 (dist9-max (gethash 'DYNAMISIM *dists*)) 10)) (dotimes (x 1) (histograham 10000 (format nil "data5/histo-~A-~A.dat" file (+ (* 1000 number) x)) (format nil "data5/histo-~A-~A.csv" file (+ (* 1000 number) x)) (format nil "data5/histo-cont-~A-~A.dat" file (+ (* 1000 number) x))) (print x))) ;======= ;(defun make-histo() (dotimes (x 5) (histograham 300 (format nil "data/histo-hig-~A.dat" x) (format nil "data/histo-hig-~A.csv" x) (format nil ;"data/histo-cont-hig-~A.dat" x)) (print x))) ;>>>>>>> .r7801 (defun histograham(&optional (number 10000) (filename "data/histo.dat") (filename2 "data/histo.csv") (filename3 "data/histo-cont.dat")) (let ((policies (list 'AG2 'PB 'AG)) (totalscores (make-hash-table)) (listofall (list))) (dolist (policy policies) (print policy) (let ((scores (make-array 101 :initial-element 0))) (dotimes (x number) (let ((score (floor (* 100 (score (POM2 1 policy)))))) (push (list score policy) listofall) (setf (aref scores score) (1+ (aref scores score))))) (setf (gethash policy totalscores) scores))) (with-open-file (out2 filename3 :direction :output :if-exists :supersede :if-does-not-exist :create) (with-open-file (out filename :direction :output :if-exists :supersede :if-does-not-exist :create) (maphash #'(lambda (k v) (let ((total 0)) (format out2 "#~A~%" k) (format out "#~A~%" k) (dotimes (y (length v)) (incf total (aref v y)) (format out2 "~A ~A~%" y total) (format out "~A ~A~%" y (aref v y))) (format out "~%~%") (format out2 "~%~%"))) totalscores))) (with-open-file (out filename2 :direction :output :if-exists :supersede :if-does-not-exist :create) (dolist (one listofall) (format out "~A, ~A~%" (first one) (second one))))))