Changes the term generator to produce shorter sequences
It now uses the (local) size bound instead of the (global) attempt count.
This commit is contained in:
parent
dd5f0dfc80
commit
f7fd6ee689
|
@ -141,8 +141,8 @@
|
|||
(define (pick-real attempt [random generator-random])
|
||||
(pick-number attempt #:top-threshold real-threshold random))
|
||||
|
||||
(define (pick-sequence-length attempt)
|
||||
(random-natural (expected-value->p ((attempt->size) attempt))))
|
||||
(define (pick-sequence-length size)
|
||||
(random-natural (expected-value->p size)))
|
||||
|
||||
(define (min-prods nt prods base-table)
|
||||
(let* ([sizes (hash-ref base-table nt)]
|
||||
|
@ -371,7 +371,7 @@
|
|||
(let ([prior (hash-ref e class #f)])
|
||||
(if prior
|
||||
prior
|
||||
(if (zero? s) 0 ((next-sequence-decision) a))))]
|
||||
(if (zero? s) 0 ((next-sequence-decision) s))))]
|
||||
[(seq env)
|
||||
(generate-sequence (λ (e) (elemg r s a e f)) e vars len)]
|
||||
[(tail env)
|
||||
|
|
|
@ -1278,8 +1278,9 @@ The argument @racket[size-expr] bounds the height of the generated term
|
|||
The optional keyword argument @racket[attempt-num-expr]
|
||||
(default @racket[1]) provides coarse grained control over the random
|
||||
decisions made during generation; increasing @racket[attempt-num-expr]
|
||||
tends to increase the complexity of the result. For example, the expected
|
||||
length of @pattech[pattern-sequence]s increases with @racket[attempt-num-expr].
|
||||
tends to increase the complexity of the result. For example, the absolute
|
||||
values of numbers chosen for @pattech[integer] patterns increase with
|
||||
@racket[attempt-num-expr].
|
||||
|
||||
The random generation process does not actively consider the constraints
|
||||
imposed by @pattech[side-condition] or @tt{_!_} @|pattern|s; instead,
|
||||
|
|
|
@ -1272,7 +1272,7 @@
|
|||
(let ([seed 0])
|
||||
(define-language L)
|
||||
(define (generate)
|
||||
(generate-term L (number ...) 10000000 #:attempt-num 10000000))
|
||||
(generate-term L (number ...) 100 #:attempt-num 10000000))
|
||||
(test (begin (random-seed seed) (generate))
|
||||
(begin (random-seed seed) (generate)))
|
||||
(let ([prg (make-pseudo-random-generator)])
|
||||
|
|
Loading…
Reference in New Issue
Block a user