>>>>> "miguel" == miguel manese <[EMAIL PROTECTED]> writes:

[Forwarding message to cmucl-help, as well]

    miguel> i have apt-get upgrade-d it and it already works. but fwiw (for cmucl
    miguel> developers), this was the code:

Upgraded what?  CMUCL?  To what version?

    miguel> (defun wfunc (freq mag)
    miguel>     "returns a value of how good the response is (from re and im) for
    miguel>      this frequency. always positive, the better the lower (best is 0)"
    miguel>     ;(declare (speed 3) (safety 0))
    miguel>     ;(declare (single-float freq mag))
    miguel>     (let* ((ub_freq 1000)
    miguel>            (ideal (if (> freq ub_freq) 0.0 1.0)))
    miguel>       (the single-float
    miguel>            (if (> mag 1.001) 1000.0
    miguel>              (let ((diff (abs (- ideal mag))))
    miguel>                (if (> diff 0.1) (* diff 10.0) diff))))))


    miguel> (defun evaluate-individual (ind wfunc idx)
    miguel>   (declare (fixnum idx))
    miguel>   (reset-evaluation)
    miguel>   (let (stream (evaled (evaluate-circuit (individual-prog ind))))
    miguel>     (unwind-protect
    miguel>         (let ((ckt-str (format nil
    miguel>                   "*title gen:~D,ind:~D,elems:~D,nodes:~D
    miguel> v1 1 0 ac 2~%rs 1 2 1k~%rl 3 0 1k
    miguel> ~A.print ac v(3)~%.ac dec 25 1 100meg quiet>> /var/tmp/spice-out~%"
    miguel>                   *cur-gen* idx *elem-count* *node-count*
    miguel>                   evaled)))
    miguel>           (setq stream (open *spice-in* :direction :output))
    miguel>           (setq *ckt-string* ckt-str)
    miguel>           (format stream ckt-str)
    miguel>           (format nil ckt-str))
    miguel>       (close stream))
    miguel>     (unwind-protect
    miguel>         (progn
    miguel>           (setq stream (open *spice-out*))
    miguel>           (do ((*line* (read-line stream nil :eof)
    miguel>                      (read-line stream nil :eof))
    miguel>                (fitness 0.0)
    miguel>                vals)
    miguel>               ((eq *line* :eof) fitness)
    miguel>               (setq vals (split *line*))
    miguel>               (unless (string-equal (car vals) "#Freq")
    miguel>                 (incf fitness (wfunc (read-from-string (first vals))
    miguel>                                      (read-from-string (second vals)))))))
    miguel>       (close stream))))

I was kind of interested in the floating-point error, but this bit of
code seems incomplete, and even if it were not, I wouldn't know how to
use it to get the error.

But if you're happy, we're happy. :-)

Ray


Reply via email to