;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of ICCLE2. ; ; ICCLE2 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. ; ; ICCLE2 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 ; along with ICCLE2. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun copy-array (array) (let ((new (make-array (array-dimensions array) :displaced-to array))) (adjust-array new (array-dimensions array) :displaced-to nil))) (defun sortkeeptrack(inputarray) (setf ua (copy-array inputarray)) (setf sa (make-array (array-dimension ua 0))) (setf xi (make-array (array-dimension ua 0))) (for i 0 (- (array-dimension ua 0) 1) (setf currentMax 0) (setf currentMaxIndex 0) (for j 0 (- (array-dimension ua 0) 1) (if (> (aref ua j) currentMax) (progn (setf currentMaxIndex j) (setf currentMax (aref ua j)) ) ) ) (setf (aref sa i) currentMax) (setf (aref xi i) currentMaxIndex) (setf (aref ua currentMaxIndex) 0) ) (list sa xi) ) (defun xisort(ua xi) (setf newarray (make-array (array-dimension ua 0))) (for i 0 (- (array-dimension ua 0) 1) (setf (aref newarray i) (aref ua (aref xi i))) ) newarray ) (defun runtrials() (setf num_trials 500) (reset-seed) (for trial 0 (- num_trials 1) (setf min_value 30) (setf max_value 500) (setf min_cost 1) (setf max_cost 100) (setf rank_tol .05) (setf num_reqs 25) (setf num_iters 6) (setf req_value_sigma (* .2 max_value)) (setf req_cost_sigma (* 0 max_cost)) ;? (setf ave_new_req_per_iter 1.4) (setf ave_unimpl_req_per_iter (* .2 num_reqs)) (setf initial_bound_lower 0.3) (setf initial_bound_higher 0.7) (setf min_iters (/ num_iters 4)) (setf end_dev_prob (/ 1 (expt num_iters (/ 1 3)))) (setf RINDS (make-array num_reqs)) (setf COST (make-array num_reqs)) (setf VALUE (make-array num_reqs)) (for i 0 (- num_reqs 1) (setf (aref COST i) (+ min_cost (my-random-int (- max_cost min_cost)))) (setf (aref VALUE i) (+ min_value (my-random-int (- max_value min_value)))) ) (print COST) (print VALUE) (setf rix (sortkeeptrack VALUE)) (setf IX (car (cdr rix))) (setf COST (xisort COST IX)) (setf VALUE (xisort VALUE IX)) (setf total_cost (eval (concatenate 'list '(+) COST))) (setf total_initial_value (eval (concatenate 'list '(+) VALUE))) (setf iteration_cost (/ total_cost num_iters)) ;(setf iter 0) (setf total_new_reqs 0) (setf total_RE_PLAN_cost 0) (setf total_RE_PLAN_OPT_cost 0) (setf total_RE_PLAN_value 0) (setf total_RE_PLAN_OPT_value 0) (setf total_AG_PLAN_cost 0) (setf total_AG_PLAN_value 0) (setf total_AG2_PLAN_cost 0) (setf total_AG2_PLAN_value 0) (setf END_DEVELOPMENT nil) (setf iteration_limit 0) (do ((iter 0 (+ iter 1))) ((not (null END_DEVELOPMENT)) nil) ( (if (>= iter min_iters) (if (= (my-random-int 1) 1) (progn (setf END_DEVELOPMENT t) (setf iteration_limit (+ (eval (concatenate 'list '(+) COST)) (/ iter num_iters))) ) (setf iteration_limit (* iter iteration_cost)) ) nil ) ;THIS IS WHERE I LEFT OFF SOURCE LINE 119 (if (= iter 0) (progn ) nil ) (print COST) (print VALUE) (print IX) (print trial) (print end_dev_prob) (format t "~%") ) )