pSpaces / jSpace

Programming with Spaces in Java
MIT License
17 stars 12 forks source link

more than one RandomSpace? #22

Closed albertolluch closed 6 years ago

albertolluch commented 6 years ago

I have updated RandomSpace

https://github.com/pSpaces/jSpace/blob/master/common/src/main/java/org/jspace/RandomSpace.java

with a more efficient implementation based on what we did in jResp:

https://github.com/michele-loreti/jResp/blob/0e4891dde80fd3785247bf5314aedfa06ebcb770/core/org.cmg.jresp.core/src/org/cmg/jresp/knowledge/ts/random/RandomSpace.java

Instead of collecting all matched tuples and then making a random choice, one can randomize the starting point of the iterator at the beginning.

However, this new implementation does not provide good randomisation properties: tuples are not uniformly chosen among the set of matching tuples. The previous version guaranteed that property (assuming Random.next() provides uniformity).

I wonder whether we should provide a better support for probabilistic programming that would allow the programmer to choose different randomisation of tuple picking.

albertolluch commented 6 years ago

This has moved to an internal discussion.