mirror of https://github.com/logos-co/scratch.git
Ready to grind out data
This commit is contained in:
parent
d85afb89c4
commit
73546f9896
|
@ -6,7 +6,7 @@
|
||||||
$.consensus_settings.glacier.evidence_alpha_2
|
$.consensus_settings.glacier.evidence_alpha_2
|
||||||
0.4 ;;2/5
|
0.4 ;;2/5
|
||||||
$.consensus_settings.glacier.confidence_beta
|
$.consensus_settings.glacier.confidence_beta
|
||||||
0.5 ;;1/2
|
1
|
||||||
$.consensus_settings.glacier.look_ahead
|
$.consensus_settings.glacier.look_ahead
|
||||||
997
|
997
|
||||||
$.consensus_settings.glacier.query.initial_query_size
|
$.consensus_settings.glacier.query.initial_query_size
|
||||||
|
@ -38,11 +38,11 @@
|
||||||
("evidence_alpha" . 0.8 )
|
("evidence_alpha" . 0.8 )
|
||||||
("evidence_alpha_2" . 0.5)
|
("evidence_alpha_2" . 0.5)
|
||||||
("confidence_beta" . 1.0)
|
("confidence_beta" . 1.0)
|
||||||
("look_ahead" . 20)
|
("look_ahead" . 500)
|
||||||
("query" :OBJ ("query_size" . 7) ("initial_query_size" . 7)
|
("query" :OBJ ("query_size" . 100) ("initial_query_size" . 100)
|
||||||
("query_multiplier" . 2) ("max_multiplier" . 4))))
|
("query_multiplier" . 1) ("max_multiplier" . 1))))
|
||||||
("distribution" :OBJ ("yes" . 0.5) ("no" . 0.5) ("none" . 0))
|
("distribution" :OBJ ("yes" . 0.5) ("no" . 0.5) ("none" . 0))
|
||||||
("byzantine_settings" :OBJ ("total_size" . 1000)
|
("byzantine_settings" :OBJ ("total_size" . 10000)
|
||||||
("distribution"
|
("distribution"
|
||||||
:OBJ ("honest" . 1) ("infantile" . 0) ("random" . 0) ("omniscient" . 0)))
|
:OBJ ("honest" . 1) ("infantile" . 0) ("random" . 0) ("omniscient" . 0)))
|
||||||
("wards" (:OBJ ("time_to_finality" :OBJ ("ttf_threshold" . 100))))
|
("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
|
;;; N.b. assumes that all JSON keys are 1) lowercase, and 2) unique
|
||||||
(defun encode-parameters (jsown)
|
(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
|
(let* ((key-json-paths
|
||||||
(loop :for (json-path _) :on (json-parameters) :by #'cddr
|
(loop :for (json-path _) :on (json-parameters) :by #'cddr
|
||||||
:collecting json-path))
|
:collecting json-path))
|
||||||
|
@ -86,14 +87,20 @@
|
||||||
(drakma:url-encode string :utf8)
|
(drakma:url-encode string :utf8)
|
||||||
string)))
|
string)))
|
||||||
|
|
||||||
|
(defun run (trials
|
||||||
(defun run (trials &key (jsown (jsown-template)))
|
&key
|
||||||
(let* ((parameters
|
parameters
|
||||||
|
(jsown (jsown-template)))
|
||||||
|
(when parameters
|
||||||
|
(loop :for (path value) :in parameters
|
||||||
|
:doing
|
||||||
|
(set-path jsown path value)))
|
||||||
|
(let* ((parameter-string
|
||||||
(encode-parameters jsown))
|
(encode-parameters jsown))
|
||||||
(id ;; TODO use host-date))
|
(id ;; TODO use host-date))
|
||||||
"0")
|
"0")
|
||||||
(base
|
(base
|
||||||
(format nil "~a-~a" id parameters))
|
(format nil "~a-~a" id parameter-string))
|
||||||
(input-settings
|
(input-settings
|
||||||
(merge-pathnames
|
(merge-pathnames
|
||||||
(concatenate 'string "var/" base ".json")
|
(concatenate 'string "var/" base ".json")
|
||||||
|
@ -108,10 +115,11 @@
|
||||||
:if-exists :supersede)
|
:if-exists :supersede)
|
||||||
|
|
||||||
(format *standard-output*
|
(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~%"
|
~&k=~a l=~a a1=~a a2=~a~%~tyes=~a no=~a~%"
|
||||||
trials
|
trials
|
||||||
(get-path jsown '$.byzantine_settings.total_size)
|
(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.query.initial_query_size)
|
||||||
(get-path jsown '$.consensus_settings.glacier.look_ahead)
|
(get-path jsown '$.consensus_settings.glacier.look_ahead)
|
||||||
(get-path jsown '$.consensus_settings.glacier.evidence_alpha)
|
(get-path jsown '$.consensus_settings.glacier.evidence_alpha)
|
||||||
|
@ -139,6 +147,19 @@
|
||||||
(values
|
(values
|
||||||
base)))
|
base)))
|
||||||
|
|
||||||
|
(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))))))
|
||||||
|
|
||||||
|
|
||||||
(defun search-parmeters ()
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
(rest (split-sequence:split-sequence #\. (string-downcase
|
(rest (split-sequence:split-sequence #\. (string-downcase
|
||||||
(symbol-name symbol)))))
|
(symbol-name symbol)))))
|
||||||
|
|
||||||
|
;; TODO implement array selectors
|
||||||
(defun get-path (jsown path)
|
(defun get-path (jsown path)
|
||||||
(cond ((symbolp path)
|
(cond ((symbolp path)
|
||||||
(get-path jsown
|
(get-path jsown
|
||||||
|
@ -20,21 +21,12 @@
|
||||||
(jsown:filter jsown (first path))
|
(jsown:filter jsown (first path))
|
||||||
(rest path)))))
|
(rest path)))))
|
||||||
|
|
||||||
#| It would be nice to use JSOWN:FILTER like this…
|
|
||||||
|
|
||||||
(defun set-path (jsown path value)
|
(defun set-path (jsown path value)
|
||||||
(setf
|
(cond ((symbolp path)
|
||||||
(jsown:filter jsown (parse-json-path path))
|
(set-path jsown
|
||||||
value)
|
(parse-json-path path)
|
||||||
jsown)
|
value))
|
||||||
|
((stringp path)
|
||||||
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)
|
|
||||||
(setf
|
(setf
|
||||||
(jsown:filter jsown path)
|
(jsown:filter jsown path)
|
||||||
value))
|
value))
|
||||||
|
@ -49,3 +41,17 @@ can't use CL:REDUCE
|
||||||
(rest path)
|
(rest path)
|
||||||
value))))
|
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
|
||||||
|
|#
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue