Skip to content

Commit

Permalink
Merge pull request #4 from awellis:dev
Browse files Browse the repository at this point in the history
Add exponentially decaying bounds
  • Loading branch information
awellis authored May 3, 2020
2 parents cd8ab4a + 6de9826 commit 3df6ff9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/DiffusionModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export AbstractSigma, ConstSigma, VarSigma
export AbstractBounds
export AbstractConstBounds, ConstSymBounds, ConstAsymBounds
export AbstractVarBounds, VarSymBounds, VarAsymBounds
export DecayingBound, DecayingBounds
export AbstractNDT, NonDecisionTime
export DiffusionModel

Expand Down
27 changes: 27 additions & 0 deletions src/boundtypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,30 @@ function get(b::AbstractVarBounds)
lo = b.lo
return (hi = hi, lo = lo)
end


# function decayingbound(type::String, b0::Real, κ::Real, Δt::Real, tmax::Real)
# type ∈ ["upper", "lower"] || error("Bound type needs to be upper or lower.")
# type = type == "upper" ? 1 : -1
# x = range(0, tmax, step = Δt)
# type .* (exp.(b0 .- κ.*x))
# end

@with_kw struct DecayingBound
bound::Array{Float64,1}

function DecayingBound(type::String, b0::Real, κ::Real, Δt::Real, tmax::Real)
type ["upper", "lower"] || error("Bound type needs to be upper or lower.")
type = type == "upper" ? 1 : -1
x = range(0, tmax, step = Δt)
return new(type .* (exp.(b0 .- κ.*x)))
end
end

@with_kw struct DecayingBounds <: AbstractVarBounds
hi::Array{Float64,1}
lo::Array{Float64,1}
function DecayingBounds(upper::DecayingBound, lower::DecayingBound)
return new(upper.bound, lower.bound)
end
end
2 changes: 1 addition & 1 deletion src/ndttypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ abstract type AbstractNDT end
lower::T
upper::T
function NonDecisionTime{T}(lower::T, upper::T) where T<:Real
@assert 0 < lower < upper
@assert 0 <= lower < upper
new(lower, upper)
end
end
Expand Down
3 changes: 0 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ choice, rt = rand(dm, 100)






# or using the basic type constructor:

drift = [1.2]
Expand Down

0 comments on commit 3df6ff9

Please sign in to comment.