Ready to grind out data

This commit is contained in:
Mark Evenson 2022-09-03 08:05:57 +02:00
parent d85afb89c4
commit 73546f9896
2 changed files with 53 additions and 26 deletions

View File

@ -6,7 +6,7 @@
$.consensus_settings.glacier.evidence_alpha_2
0.4 ;;2/5
$.consensus_settings.glacier.confidence_beta
0.5 ;;1/2
1
$.consensus_settings.glacier.look_ahead
997
$.consensus_settings.glacier.query.initial_query_size
@ -38,11 +38,11 @@
("evidence_alpha" . 0.8 )
("evidence_alpha_2" . 0.5)
("confidence_beta" . 1.0)
("look_ahead" . 20)
("query" :OBJ ("query_size" . 7) ("initial_query_size" . 7)
("query_multiplier" . 2) ("max_multiplier" . 4))))
("look_ahead" . 500)
("query" :OBJ ("query_size" . 100) ("initial_query_size" . 100)
("query_multiplier" . 1) ("max_multiplier" . 1))))
("distribution" :OBJ ("yes" . 0.5) ("no" . 0.5) ("none" . 0))
("byzantine_settings" :OBJ ("total_size" . 1000)
("byzantine_settings" :OBJ ("total_size" . 10000)
("distribution"
:OBJ ("honest" . 1) ("infantile" . 0) ("random" . 0) ("omniscient" . 0)))
("wards" (:OBJ ("time_to_finality" :OBJ ("ttf_threshold" . 100))))
@ -62,6 +62,7 @@
;;; N.b. assumes that all JSON keys are 1) lowercase, and 2) unique
(defun encode-parameters (jsown)
"Encode the Glacier parameters specfied by the JSOWN settings as a string suitable for use in a filename."
(let* ((key-json-paths
(loop :for (json-path _) :on (json-parameters) :by #'cddr
:collecting json-path))
@ -86,14 +87,20 @@
(drakma:url-encode string :utf8)
string)))
(defun run (trials &key (jsown (jsown-template)))
(let* ((parameters
(defun run (trials
&key
parameters
(jsown (jsown-template)))
(when parameters
(loop :for (path value) :in parameters
:doing
(set-path jsown path value)))
(let* ((parameter-string
(encode-parameters jsown))
(id ;; TODO use host-date))
"0")
(base
(format nil "~a-~a" id parameters))
(format nil "~a-~a" id parameter-string))
(input-settings
(merge-pathnames
(concatenate 'string "var/" base ".json")
@ -108,10 +115,11 @@
:if-exists :supersede)
(format *standard-output*
"~&Runnning ~a trials across ~a nodes~
"~&Runnning ~a trials across ~a nodes for ~a rounds~
~&k=~a l=~a a1=~a a2=~a~%~tyes=~a no=~a~%"
trials
(get-path jsown '$.byzantine_settings.total_size)
(get-path (first (get-path jsown '$.wards)) '$.time_to_finality.ttf_threshold)
(get-path jsown '$.consensus_settings.glacier.query.initial_query_size)
(get-path jsown '$.consensus_settings.glacier.look_ahead)
(get-path jsown '$.consensus_settings.glacier.evidence_alpha)
@ -139,6 +147,19 @@
(values
base)))
(defun search-parmeters ()
(defun search-parameters ()
;; not exactly sure why something like
;; (loop :for yes :from 0.4 :to 0.6 :by 0.05… has rounding problems
;;
(loop :for yes :from 2/5 :to 3/5 :by 1/20
:for no :from 3/5 :downto 2/5 :by 1/20
:with rounds = 10000
:doing
(run 10
:parameters
`(($.byzantine_settings.total_size ,(expt 10 4))
($.distribution.yes ,(coerce yes 'single-float))
($.distribution.no ,(coerce no 'single-float))))))

View File

@ -6,6 +6,7 @@
(rest (split-sequence:split-sequence #\. (string-downcase
(symbol-name symbol)))))
;; TODO implement array selectors
(defun get-path (jsown path)
(cond ((symbolp path)
(get-path jsown
@ -20,21 +21,12 @@
(jsown:filter jsown (first path))
(rest path)))))
#| It would be nice to use JSOWN:FILTER like this…
(defun set-path (jsown path value)
(setf
(jsown:filter jsown (parse-json-path path))
value)
jsown)
but that doesn't easily work due to JSOWN:FILTER being a macro, so one
can't use CL:REDUCE
|#
(defun set-path (jsown path value)
(cond ((stringp path)
(cond ((symbolp path)
(set-path jsown
(parse-json-path path)
value))
((stringp path)
(setf
(jsown:filter jsown path)
value))
@ -49,3 +41,17 @@ can't use CL:REDUCE
(rest path)
value))))
#| It would have be nice to use JSOWN:FILTER like this…
(defun set-path (jsown path value)
(setf
(jsown:filter jsown (parse-json-path path))
value)
jsown)
but that doesn't easily work due to JSOWN:FILTER being a macro, so one
can't use CL:REDUCE
|#