;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of "NOVA": NOVA = search + COCOMO tools ; Copyright, 2008, Tim Menzies tim@menzies.us ; ; NOVA is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; NOVA is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; a long with NOVA. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package #:xomo.experiments) (let ((output-attribute-list '(prec flex resl team pmat time stor data pvol ruse rely docu acap pcap pcon aexp plex ltex tool sced cplx site a b kloc effort))) (labels ((attr2pv (attr) (if (eql attr 'effort) (effort) (let ((value (! attr))) (if (member attr '(a b kloc)) value (etypecase value (em (em2effort attr)) (sf (sf2effort attr))))))) (dump-lc-attr-value-list () (mapcar #'(lambda (attr) (cons attr (attr2pv attr))) output-attribute-list)) (order-values (attr-value-list) (mapcar #'(lambda (attr) (geta attr attr-value-list)) output-attribute-list))) (defun lc-comparo-dump (result stream iterations) (with-constraints-of-state (result-best-state result) (format stream "~&#~{~a~^,~}" output-attribute-list) (dolist (lc-attr-value-list (monte-carlo :score-fn #'dump-lc-attr-value-list :combine-fn #'identity :n iterations)) (format stream "~&~{~7,6f~^,~}" (order-values lc-attr-value-list))))))) (defun lc-comparo (&key (iterations 1000) (base-output-directory nova.settings:*nova-output-dir*)) (let ((scenarios '(("ALL-strategic" nova.impl.case-studies:default xomo.policies:strategic ) ("ALL-tactical" nova.impl.case-studies:default xomo.policies:tactical ) ("OSP-strategic" xomo.case-studies:osp xomo.policies:strategic ) ("OSP-tactical" xomo.case-studies:osp xomo.policies:tactical ) ("OSP2-strategic" xomo.case-studies:osp2 xomo.policies:strategic ) ("OSP2-tactical" xomo.case-studies:osp2 xomo.policies:tactical ) ("flight-strategic" xomo.case-studies:flight xomo.policies:strategic ) ("flight-tactical" xomo.case-studies:flight xomo.policies:tactical ) ("ground-strategic" xomo.case-studies:ground xomo.policies:strategic ) ("ground-tactical" xomo.case-studies:ground xomo.policies:tactical ))) (search-engine-descriptor (lookup-search-engine 'nova.impl.search-engines:sa)) (find-best-state-method (lookup-find-best-state-method 'min-score-state-of-path-by-ttest))) (let* ((lc-sub-directory-name (concatenate 'string "lc-comparo" "/" (date-stamp) "/")) (output-directory (merge-pathnames lc-sub-directory-name base-output-directory))) (format t "~&~a" output-directory) (ensure-directories-exist output-directory :verbose t) (dolist (scenario scenarios) (format t "~&~a" scenario) (let ((file-name (first scenario)) (case-study-id (second scenario)) (policy-id (third scenario))) (with-open-file (file (merge-pathnames (make-pathname :name file-name) output-directory) :direction :output :if-exists :supersede :if-does-not-exist :create) ;;FIXME score function needs passed in (let ((result (nova-learn (lookup-evaluation-method 'xomo.evaluation-methods:energy) search-engine-descriptor find-best-state-method :case-study (lookup-case-study case-study-id) :policy (lookup-policy policy-id)))) (lc-comparo-dump result file iterations))))))))