[R] applying random functions to multisets

From: <zbynek.janoska_at_gmail.com>
Date: Fri, 25 Mar 2011 04:58:21 -0700 (PDT)

I am solving following problem:

Suppose I have some multiset:
> multiset <- c("a","a","c","d","d")
and rules, which operate with it (for simplicity not writen in R functions)
> rule1: "a" -> c("a","b")
> rule2: "a" -> c("a","c")
> rule3: "c" -> c("c","c")
> ruleX: ...

I want to apply rules to multiset in maximaly parallel manner, but randomly (ie. rule1 and rule2 both work with object "a", but i want them to apply in non-deterministic way, so every time I run this procedure, I can get different result)

Basically what I am looking for is some construct, which would enable me to do this:

while (initial.multiset IS NOT empty){
apply(random rule, if possible)

I tried to organize rules into list, but i don't know how to select randomly function from a list and apply it

Any help would be appreciated


View this message in context: http://r.789695.n4.nabble.com/applying-random-functions-to-multisets-tp3405203p3405203.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 25 Mar 2011 - 13:10:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Mar 2011 - 13:20:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive