Skip to content

Commit

Permalink
Move out Monte Solve
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 7, 2017
1 parent 04ea538 commit 6146d23
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 41 deletions.
2 changes: 2 additions & 0 deletions src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ export DEAlgorithm, AbstractODEAlgorithm, AbstractSDEAlgorithm,

# Monte Carlo Simulations
@compat abstract type AbstractMonteCarloProblem <: DEProblem end
@compat abstract type AbstractMonteCarloEstimator <: DEProblem end

export AbstractMonteCarloProblem, MonteCarloProblem
export MonteCarloSolution, MonteCarloTestSolution
export AbstractMonteCarloEstimator

@compat abstract type DEOptions end
@compat abstract type DECache end
Expand Down
9 changes: 0 additions & 9 deletions src/solutions/monte_solutions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ function calculate_monte_errors(sim::AbstractMonteCarloSolution)
return MonteCarloTestSolution(solution_data,errors,error_means,error_medians,sim.elapsedTime)
end

function solve(prob::AbstractMonteCarloProblem,alg;num_monte=10000,kwargs...)
elapsedTime = @elapsed solution_data = pmap((i)-> begin
new_prob = prob.prob_func(deepcopy(prob.prob),i)
prob.output_func(solve(new_prob,alg;kwargs...))
end,1:num_monte)
solution_data = convert(Array{typeof(solution_data[1])},solution_data)
return(MonteCarloSolution(solution_data,elapsedTime))
end

Base.length(sim::AbstractMonteCarloSolution) = length(sim.solution_data)
Base.endof( sim::AbstractMonteCarloSolution) = length(sim)
Base.getindex(sim::AbstractMonteCarloSolution,i::Int) = sim.solution_data[i]
Expand Down
31 changes: 0 additions & 31 deletions test/monte.jl

This file was deleted.

1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ using Base.Test
@time @testset "Solution Interface" begin include("solution_get_tests.jl") end
@time @testset "Extended Functions" begin include("extended_function_tests.jl") end
@time @testset "Callbacks" begin include("callbacks.jl") end
@time @testset "Monte Carlo Simulations" begin include("monte.jl") end
@time @testset "Constructed Parameterized Functions" begin include("constructed_pf_test.jl") end
@time @testset "Plot Variables" begin include("plot_vars.jl") end

0 comments on commit 6146d23

Please sign in to comment.