(defun demo-search1 () (highMidLow 'AG) (highMidLow 'AG2) (highMidLow 'HY) (highMidLow 'PB)) (defun highMidLow (type) (format t "~%===================~%This is High/Mid/Low for ~A~%======================~%" type) (let ((parameters (list (list 'DYNAMISIM 0 0) (list 'CRITICALITY 0 0) (list 'CULTURE 0 0) (list 'TEAMSIZE 0 0) (list 'SIZE 0 0) (list 'TEAM-ALPHA 0 0))) (counts (list (list 'DYNAMISIM 0 0 0) (list 'CRITICALITY 0 0 0) (list 'CULTURE 0 0 0) (list 'TEAMSIZE 0 0 0) (list 'SIZE 0 0 0) (list 'TEAM-ALPHA 0 0 0))) (timesToRun 1000) (timesRun 0) (totalScore 0)) (setf parameters (mapcar #'(lambda (x) (list (first x) (float (+ (dist9-min (gethash (first x) *dists*)) (/ (- (dist9-max (gethash (first x) *dists*)) (dist9-min (gethash (first x) *dists*))) 3))) (float (- (dist9-max (gethash (first x) *dists*)) (/ (- (dist9-max (gethash (first x) *dists*)) (dist9-min (gethash (first x) *dists*))) 3))))) parameters)) (dotimes (x timesToRun) (if (= (mod x 100) 0) (format t "~%")) (format t ".") (let* ((treatment (completeallbut '())) (score (runPom2 type treatment))) (incf totalScore score) (incf timesRun) (let ((avgScore (/ totalScore timesRun))) (if (> score avgScore) (dolist (parameter treatment) (if (< (second parameter) (second (find (first parameter) parameters :key #'first))) (incf (second (find (first parameter) counts :key #'first))) (if (> (second parameter) (third (find (first parameter) parameters :key #'first))) (incf (fourth (find (first parameter) counts :key #'first))) (incf (third (find (first parameter) counts :key #'first)))))) (if (< score avgScore) (dolist (parameter treatment) (if (< (second parameter) (second (find (first parameter) parameters :key #'first))) (incf (second (find (first parameter) counts :key #'first))) (if (> (second parameter) (third (find (first parameter) parameters :key #'first))) (decf (fourth (find (first parameter) counts :key #'first))) (decf (third (find (first parameter) counts :key #'first))))))))))) (let ((limits (mapcar #'(lambda (x) (let* ((max (reduce #'max (rest x))) (limit (/ max 2))) (list (first x) (if (> (second x) limit) 1 0) (if (> (third x) limit) 1 0) (if (> (fourth x) limit) 1 0)))) counts))) (format t "~%==========~%Results:~%") (mapcar #'(lambda (x) (cond ((equal (rest x) (list 1 1 1)) (format t "~A=~A~%" (first x) "All")) ((equal (rest x) (list 0 0 1)) (format t "~A=~A~%" (first x) "High")) ((equal (rest x) (list 0 1 0)) (format t "~A=~A~%" (first x) "Mid")) ((equal (rest x) (list 0 1 1)) (format t "~A=~A~%" (first x) "Mid-High")) ((equal (rest x) (list 1 0 0)) (format t "~A=~A~%" (first x) "Low")) ((equal (rest x) (list 1 0 1)) (format t "~A=~A~%" (first x) "Low or High")) ((equal (rest x) (list 1 1 0)) (format t "~A=~A~%" (first x) "Low-Mid")))) limits))) nil)