temp
This commit is contained in:
		| @@ -5,6 +5,7 @@ version = "0.1.0" | |||||||
|  |  | ||||||
| [deps] | [deps] | ||||||
| Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||||||
|  | Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||||||
| ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||||||
| LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||||||
| NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" | NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| module Thesis | module Thesis | ||||||
|  |  | ||||||
|   using LinearAlgebra, ForwardDiff, PlotlyJS, SPICE |   using LinearAlgebra, ForwardDiff, PlotlyJS, SPICE, Distributed | ||||||
|  |  | ||||||
|   try |   try | ||||||
|     furnsh("../../SPICE/naif0012.tls") |     furnsh("../../SPICE/naif0012.tls") | ||||||
|   | |||||||
| @@ -11,6 +11,12 @@ function mass_est(T) | |||||||
|   return ans/n |   return ans/n | ||||||
| end | end | ||||||
|  |  | ||||||
|  | converged(x) = NLsolve.converged(x) | ||||||
|  |  | ||||||
|  | function converged(_::String) | ||||||
|  |   return false | ||||||
|  | end | ||||||
|  |  | ||||||
| function nlp_solve(start::Vector{Float64}, | function nlp_solve(start::Vector{Float64}, | ||||||
|                    final::Vector{Float64}, |                    final::Vector{Float64}, | ||||||
|                    craft::Sc, |                    craft::Sc, | ||||||
| @@ -25,6 +31,21 @@ function nlp_solve(start::Vector{Float64}, | |||||||
|     F[1:6, 1] .= prop_nlsolve(tanh.(x), start, craft, μ, tf-t0) .- final |     F[1:6, 1] .= prop_nlsolve(tanh.(x), start, craft, μ, tf-t0) .- final | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   return nlsolve(f!, atanh.(x0), ftol=tol, autodiff=:forward, iterations=1_000) |   # return nlsolve(f!, atanh.(x0), ftol=tol, autodiff=:forward, iterations=1_000) | ||||||
|  |   p = addprocs(1) | ||||||
|  |   response = Channel(1) | ||||||
|  |   @async  put!(response, remotecall_fetch(nlsolve, 2, f!, atanh.(x0), ftol=tol, autodiff=:forward, iterations=1_000)) | ||||||
|  |  | ||||||
|  |   start=time() | ||||||
|  |   while !isready(response) && (time() - start) < 30. | ||||||
|  |     sleep(0.1) | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   if isready(response) | ||||||
|  |     return fetch(response) | ||||||
|  |   else | ||||||
|  |     rmprocs(p); | ||||||
|  |     return "error" | ||||||
|  |   end | ||||||
|  |  | ||||||
| end | end | ||||||
| @@ -40,9 +40,7 @@ function mbh(start::AbstractVector, | |||||||
|     if verbose print("\r",i) end |     if verbose print("\r",i) end | ||||||
|     # TODO: Should this be two separate "impatience" values? |     # TODO: Should this be two separate "impatience" values? | ||||||
|     impatience = 0 |     impatience = 0 | ||||||
|     println("HERE") |  | ||||||
|     x_star = nlp_solve(start, final, craft, μ, t0, tf, new_x(n), tol=tol) |     x_star = nlp_solve(start, final, craft, μ, t0, tf, new_x(n), tol=tol) | ||||||
|     println("THERE") |  | ||||||
|     while converged(x_star) == false && impatience < patience_level |     while converged(x_star) == false && impatience < patience_level | ||||||
|       impatience += 1 |       impatience += 1 | ||||||
|       x_star = nlp_solve(start, final, craft, μ, t0, tf, new_x(n), tol=tol) |       x_star = nlp_solve(start, final, craft, μ, t0, tf, new_x(n), tol=tol) | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ end | |||||||
|   # include("inner_loop/laguerre-conway.jl") |   # include("inner_loop/laguerre-conway.jl") | ||||||
|   # include("inner_loop/propagator.jl") |   # include("inner_loop/propagator.jl") | ||||||
|   # include("inner_loop/find_closest.jl") |   # include("inner_loop/find_closest.jl") | ||||||
|   # include("inner_loop/monotonic_basin_hopping.jl") |   include("inner_loop/monotonic_basin_hopping.jl") | ||||||
|   include("inner_loop/inner_loop.jl") |   include("inner_loop/inner_loop.jl") | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Connor
					Connor