(define *countries* '("Norwegen" "Schweden" "Finnland" "Dänemark" "Großbritannien" "Deutschland" "Griechenland" "Spanien" "Frankreich" "Irland" "Italien" "Luxenburg" "Niederlande" "Österreich" "Portugal" "Bulgarien" "Malta" "Zypern" "Polen" "Tsechische Republick" "Rumänien" "Estland" "Slowakei" "Ungarn" "Slowenien" "Litauen")) (define (random-country) (list-ref *countries* (random (length *countries*)))) (define (make-random-endpoints) (let ((source (random-country))) (let lp ((dest (random-country))) (if (not (string=? source dest)) (values source dest) (lp (random-country)))))) (define (make-random-link-type) (list-ref '(satellite groundlink) (random 2))) (define (make-random-capacity) (let* ((distribution '(small small small medium medium large)) (ranges-alist '((small (1000 50000)) (medium (50001 150000)) (large (150001 300000)))) (range (list-ref distribution (random (length distribution)))) (min (caadr (assoc range ranges-alist))) (max (cadadr (assoc range ranges-alist)))) (+ min (random max)))) (define (make-random-price capacity link-type) (let ((factor (cadr (assoc link-type '((groundlink 1) (satellite 2))))) (rand (+ 1 (random 3)))) (* factor rand (quotient capacity 300)))) (define (make-random-list-entry) (let ((capacity (make-random-capacity)) (link-type (make-random-link-type))) (call-with-values make-random-endpoints (lambda (source dest) (list source dest link-type capacity (make-random-price capacity link-type)))))) ;;; Gibt eine Liste aller Angebote zurueck. Jedes Element dieser Liste ;;; ist ebenfalls eine Liste mit diesem Format: ;;; (anfangspunkt endpunkt verbindungsart kapazitaet mindestgebot) ;;; ;;; anfangspunkt und endpunkt sind Strings ;;; verbindungsart ist ein Symbol: Entweder 'satellite oder 'groundlink ;;; kapazitaet und mindestgebot sind Integerzahlen (define (bimasuun-get-offers) (let lp ((count (+ 25 (random 125))) (res '())) (if (zero? count) res (lp (- count 1) (cons (make-random-list-entry) res)))))