Jump to content

Featured Replies

Posted

hi all,

i coded a little markov-program who changes the LEVEL-size if necessary to generate the number of values you want exactly.

 

it would be nice if someone could check/test the IDEA, and if it's correct and makes sense :-)

 

the markov starts on LEVEL 3 and tries to generate a number of output-levels with its TRANSITION-rules (level-3-rules), if it's possible (=generating the size) everything's fine. but if it's not possible, then the programm changes on LEVEL-2-rules ... if this is also not possible (to generate the size) then it changes to LEVEL 1... 

 

here is the code...

 

;;;FUNCTION

(defun gen-multiple-markov (sequence &key size)
  (let ((transitions-level-1 (gen-markov-transitions sequence :level 1)) ;; gen transition-table level-1
        (transitions-level-2 (gen-markov-transitions sequence :level 2)) ;; gen transition-table level-2
        (seq (gen-markov-from-transitions (gen-markov-transitions sequence :level 3) :size size))) ;; gen markov-seq on level-3

    (if (< (length seq) size) ;; test if seq is too short (/= (length seq) size)
      (progn ;; if too short -> combine the last seq with a new one (level 2)
        (setq seq (append seq (gen-markov-from-transitions transitions-level-2 :size (- size (length seq)) :start (last seq))))
        (if (< (length seq) size) ;; same test as above
          (append (append seq (gen-markov-from-transitions transitions-level-1 :size (- size (length seq)) :start (last seq))))
          (append seq)))
                      
      (append seq))))

                      
                      
;;;TEST
                      
(gen-multiple-markov '(1 2 3 2 1 2 3 2 1 2 2 2 2 1 1 1 1 2 2 3 2 1 1 2) :size 36)
          
    

 

best wishes and THANX

andré

 

 

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy