[jira] [Created] (MATH-654) ValueServer not deterministic for a fixed random number seed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (MATH-654) ValueServer not deterministic for a fixed random number seed

ASF GitHub Bot (Jira)
ValueServer not deterministic for a fixed random number seed
------------------------------------------------------------

                 Key: MATH-654
                 URL: https://issues.apache.org/jira/browse/MATH-654
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 2.2
            Reporter: David James


I have built an agent-based model using the Apache Commons Math library, which has come in handy.

The ValueServer seemed particularly helpful, as explained at:
http://commons.apache.org/math/userguide/random.html

My simulation needs repeatable randomness, so I used this form of the ValueServer constructor:

    ValueServer(RandomData randomData)
    Construct a ValueServer instance using a RandomData as its source of random data.
    // http://commons.apache.org/math/api-2.2/org/apache/commons/math/random/ValueServer.html

However, in my simulation, I found that the ValueServer did not act deterministically if I supplied the same random number seed.

I have not inspected the source code, but I suspect that the ValueServer is not using the `randomData` generator correctly. If it was, then it should be deterministic.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-654) ValueServer not deterministic for a fixed random number seed

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated MATH-654:
-----------------------------

    Affects Version/s: 1.1
                       1.2
                       2.0
                       2.1
        Fix Version/s: 3.0

Thanks for reporting this.  I assume you are using DIGEST_MODE.  If this is the case and you are comfortable compiling the code in trunk, the fix for MATH-634 enables a workaround for this.  Using the reseed method added to EmpiricalDistributionImpl in trunk, you can use ValueServer's getEmpiricalDistribution to get the distribution and then invoke reseed.  Unfortunately, this method does not exist in any released version yet.

The problem is that ValueServer#getNextDigest (what it does for getNext in DIGEST_MODE) delegates to EmpiricalDistributionImpl#getNextValue.  EmpiricalDistributionImpl has its own RandomData instance.  To fix this issue, EmpiricalDistirbutionImpl should add a constructor taking a RandomData and ValueServer should provide this.

> ValueServer not deterministic for a fixed random number seed
> ------------------------------------------------------------
>
>                 Key: MATH-654
>                 URL: https://issues.apache.org/jira/browse/MATH-654
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.2, 2.0, 2.1, 2.2
>            Reporter: David James
>            Assignee: Phil Steitz
>             Fix For: 3.0
>
>
> I have built an agent-based model using the Apache Commons Math library, which has come in handy.
> The ValueServer seemed particularly helpful, as explained at:
> http://commons.apache.org/math/userguide/random.html
> My simulation needs repeatable randomness, so I used this form of the ValueServer constructor:
>     ValueServer(RandomData randomData)
>     Construct a ValueServer instance using a RandomData as its source of random data.
>     // http://commons.apache.org/math/api-2.2/org/apache/commons/math/random/ValueServer.html
> However, in my simulation, I found that the ValueServer did not act deterministically if I supplied the same random number seed.
> I have not inspected the source code, but I suspect that the ValueServer is not using the `randomData` generator correctly. If it was, then it should be deterministic.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (MATH-654) ValueServer not deterministic for a fixed random number seed

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz resolved MATH-654.
------------------------------

    Resolution: Fixed

Fixed in r1163875. ValueServer now exposes a reSeed method that when supplied a fixed seed will generate a fixed sequence in any stochastic mode. The RandomDataImpl that it uses internally is passed to the EmpiricalDistributionImpl it creates when used in DIGEST_MODE.  The changes for this issue include an incompatible (vs. 2.x) change: the constructor for EmpiricalDistributionImpl that previously took a RandomData now takes a RandomDataImpl.  The plan for 3.0 is to merge these.

> ValueServer not deterministic for a fixed random number seed
> ------------------------------------------------------------
>
>                 Key: MATH-654
>                 URL: https://issues.apache.org/jira/browse/MATH-654
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 1.1, 1.2, 2.0, 2.1, 2.2
>            Reporter: David James
>            Assignee: Phil Steitz
>             Fix For: 3.0
>
>
> I have built an agent-based model using the Apache Commons Math library, which has come in handy.
> The ValueServer seemed particularly helpful, as explained at:
> http://commons.apache.org/math/userguide/random.html
> My simulation needs repeatable randomness, so I used this form of the ValueServer constructor:
>     ValueServer(RandomData randomData)
>     Construct a ValueServer instance using a RandomData as its source of random data.
>     // http://commons.apache.org/math/api-2.2/org/apache/commons/math/random/ValueServer.html
> However, in my simulation, I found that the ValueServer did not act deterministically if I supplied the same random number seed.
> I have not inspected the source code, but I suspect that the ValueServer is not using the `randomData` generator correctly. If it was, then it should be deterministic.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira