|
@@ -37,6 +37,7 @@
|
|
(defun make-logger (filename &key
|
|
(defun make-logger (filename &key
|
|
(name "experiment name")
|
|
(name "experiment name")
|
|
(kind :log)
|
|
(kind :log)
|
|
|
|
+ (header '())
|
|
(filter #'(lambda (generation-number)
|
|
(filter #'(lambda (generation-number)
|
|
(declare (ignore generation-number))
|
|
(declare (ignore generation-number))
|
|
t))
|
|
t))
|
|
@@ -51,6 +52,7 @@
|
|
*** `str` - stream to write report to
|
|
*** `str` - stream to write report to
|
|
*** `generation-number` - the current generation number
|
|
*** `generation-number` - the current generation number
|
|
*** `population` - an array of individuals in current population
|
|
*** `population` - an array of individuals in current population
|
|
|
|
+ * `header` - a list of column headings for a :log style of output
|
|
* `filter` - function returns t/nil for a generation number, used to
|
|
* `filter` - function returns t/nil for a generation number, used to
|
|
select which generations the report is generated for.
|
|
select which generations the report is generated for.
|
|
* `if-exists` - parameter passed to `with-open-file` - use `:supersede` to replace
|
|
* `if-exists` - parameter passed to `with-open-file` - use `:supersede` to replace
|
|
@@ -61,6 +63,8 @@
|
|
:direction :output
|
|
:direction :output
|
|
:if-exists if-exists
|
|
:if-exists if-exists
|
|
:if-does-not-exist :create)
|
|
:if-does-not-exist :create)
|
|
|
|
+ (when (and (eq kind :log) (not (null header))) ; put header on log file
|
|
|
|
+ (format str "~{~a~^, ~}~&" header))
|
|
(when (eq kind :trace) ; put header on yml trace
|
|
(when (eq kind :trace) ; put header on yml trace
|
|
(format str "---~&name: ~a~&" name)))
|
|
(format str "---~&name: ~a~&" name)))
|
|
;; return a log-function
|
|
;; return a log-function
|