[julia-users] Re: Implementing Gillespie's Stochastic Simulation Algorithm

2014-04-11 Thread David P. Sanders


El viernes, 11 de abril de 2014 16:19:24 UTC-5, Simon Frost escribió:
>
> I just added a draft implementation along the lines of ODE.jl:
>
> https://github.com/sdwfrost/Gillespie.jl
>

At a first glance it looks nice; I hope I get a chance to look at it in 
more detail soon.

 


[julia-users] Re: Implementing Gillespie's Stochastic Simulation Algorithm

2014-04-11 Thread Simon Frost
I just added a draft implementation along the lines of ODE.jl:

https://github.com/sdwfrost/Gillespie.jl



[julia-users] Re: Implementing Gillespie's Stochastic Simulation Algorithm

2014-04-11 Thread Simon Frost

Dear David,

It probably would be easier to pass a function that, given the current 
states and the parameters, returned a Float64 vector of rates. The main 
issue that I have is that eval can't see all the variables defined in the 
function scope, so my code runs fine if run globally, but not as a 
function. If I go along that route, it would probably be best to define an 
appropriate model type, rather like Tim Vaughan's MASTER program:

https://github.com/CompEvol/MASTER/wiki/Trajectory-specification

I'll tweak my code to work with functions, and push to github when I get a 
chance.

Best
Simon


[julia-users] Re: Implementing Gillespie's Stochastic Simulation Algorithm

2014-04-10 Thread David P. Sanders


El jueves, 10 de abril de 2014 10:19:14 UTC-5, David P. Sanders escribió:
>
>
>
> El miércoles, 9 de abril de 2014 03:40:40 UTC-5, Simon Frost escribió:
>>
>> Dear All,
>>
>> I'm implementing Gillespie's direct method for stochastic simulation:
>>
>> http://en.wikipedia.org/wiki/Gillespie_algorithm
>>
>> I'm loosely following the API for the now-orphaned R package GillespieSSA:
>>
>> http://www.jstatsoft.org/v25/i12
>>
>> http://artax.karlin.mff.cuni.cz/r-help/library/GillespieSSA/html/ssa.html
>>
>> In Julia, the analogous function call is something like the following.
>>
>> function 
>> ssa(x0::Vector{Int64},a::Vector{Expr},nu::Matrix{Float64,2},parms::Expr,tf::Float64,ignore_negative_state::Bool,console_interval::Int64,census_interval::Int64,verbose::Bool,max_wall_time::Float64)
>>
>> However, as I've never done metaprogramming in Julia before, I was 
>> wondering whether anyone had any input to make the model definition as 
>> clean as possible (i.e. without cluttering the syntax with symbols, while 
>> not polluting the environment)?
>>
>> Best
>> Simon
>>
>
> Hi Simon,
>
> This is a nice idea! I'm very interested.
>
> Unfortunately, I don't have the necessary experience either, but there are 
> other packages which could be useful, such as ODE solvers, which have the 
> same issue of how to best define the model. For example:
>
> https://github.com/JuliaLang/Sundials.jl
>
>
And 
https://github.com/JuliaLang/ODE.jl

In fact, as a first step, I guess it would be much easier to just pass in a 
standard Julia function, rather than trying to parse something.



 

> Personally, the ssa() function you are proposing seems rather complicated. 
> Perhaps it would be better to have some kind of new type that wraps all the 
> needed parameters in one place? 
>
> Best
> David.
>
>
>
>
>  
>


[julia-users] Re: Implementing Gillespie's Stochastic Simulation Algorithm

2014-04-10 Thread David P. Sanders


El miércoles, 9 de abril de 2014 03:40:40 UTC-5, Simon Frost escribió:
>
> Dear All,
>
> I'm implementing Gillespie's direct method for stochastic simulation:
>
> http://en.wikipedia.org/wiki/Gillespie_algorithm
>
> I'm loosely following the API for the now-orphaned R package GillespieSSA:
>
> http://www.jstatsoft.org/v25/i12
>
> http://artax.karlin.mff.cuni.cz/r-help/library/GillespieSSA/html/ssa.html
>
> In Julia, the analogous function call is something like the following.
>
> function 
> ssa(x0::Vector{Int64},a::Vector{Expr},nu::Matrix{Float64,2},parms::Expr,tf::Float64,ignore_negative_state::Bool,console_interval::Int64,census_interval::Int64,verbose::Bool,max_wall_time::Float64)
>
> However, as I've never done metaprogramming in Julia before, I was 
> wondering whether anyone had any input to make the model definition as 
> clean as possible (i.e. without cluttering the syntax with symbols, while 
> not polluting the environment)?
>
> Best
> Simon
>

Hi Simon,

This is a nice idea! I'm very interested.

Unfortunately, I don't have the necessary experience either, but there are 
other packages which could be useful, such as ODE solvers, which have the 
same issue of how to best define the model. For example:

https://github.com/JuliaLang/Sundials.jl

Personally, the ssa() function you are proposing seems rather complicated. 
Perhaps it would be better to have some kind of new type that wraps all the 
needed parameters in one place? 

Best
David.