[R] applying random functions to multisets
zbynek.janoska@gmail.com
zbynek.janoska at centrum.cz
Fri Mar 25 12:58:21 CET 2011
Hi,
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)
return(new.multiset)
}
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
Thanks
Zbynek
--
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.
More information about the R-help
mailing list